Home > Software engineering >  ChromeDriver click button throw exception
ChromeDriver click button throw exception

Time:12-08

I am using ChromeDriver to inspect and request to process data. I can see all the steps carried out successfully but throw exception when it come to 'Click button' to generate report. not sure what it does meaning here

enter image description here

error

element click intercepted: Element <input id="generate_report_button" class="ImageButtonWide" name="report" type="button" value="Generate Report" onclick="redirectGenerate(jQuery(this))"> is not clickable at point (525, 658). Other element would receive the click: <div class="cc-cookies " id="eu_cookie_bar">...</div>

(Session info: chrome=96.0.4664.45)

Code

using (ChromeDriver window = new ChromeDriver(chromeOptions))
{
    try
    {

    var btnReport = window.FindElement(By.Name("report"));
    log.Debug("Found 'report' button");
    
    // remaining code 
    new SelectElement(selFormat).SelectByValue("csv");
    log.Info("Selected 'csv' from 'format' select list");

    btnReport.Click();
    log.Debug("Clicked 'report' button");

enter image description here

CodePudding user response:

you can attempt to force click button using Actions API :

 Actions action = new Actions(IWebDriver);
 action.Click(IWebElement).Build().Perform();

you get this error - "element is not clickable at point (525, 658). Other element would receive the click" when two elements are overlapping and webdriver warns you that the desired element might not receive the click.

  • Related