Search This Blog

Breaking

Thursday, 16 September 2021

[Fix] -> Clicking on elements is failing in Jenkins

 Recently, I encountered a weird issue where in my local machine, all my UI Automation scripts were working perfectly fine but when same ran on Jenkins machine, they started failing by giving exception: Element is not clickable at this point. I first thought, it might be happening because of different resolution of Jenkin machine (which still a possible reason) but unfortunately, I didn't have access to that Jenkin machine where it was failing.

To fix this, I tried to change the selenium click method to java script executor click method. And, it worked.













WebElement elem = driver.findElement(By.xpath("your xpath"));

JavascriptExecutor executor = (JavascriptExecutor) driver;

executor.executeScript("arguments[0].click();", elem);


So the second thing which I did was changing all click method to java script executor click. But then I identified, that few of the clicks are not working.

Those were the elements which were present as Button in the webpage. So I didn't change that click.

And It resolved.

No comments:

Post a Comment