Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webdriver warning the server did not provide any stacktrace information

I have written driver.findElement(By.id("kfiDocumentLink")).click(); code for clicking on the button 'KFI Document'.

Please find the HTML code.

<a class="button" id="kfiDocumentLink" href="/Quote/KFIDocument/The%20Co-operative%20Bank%20-%20Download%20Mortgage%20Illustration%20(PDF)%20160808104103" target="_blank">Download Mortgage Illustration (PDF)</a>

When I run the code, sometimes I am able to click on the button and sometimes I am unable to click the button.

Could someone assist on this please?

like image 723
Lakshmi D Avatar asked Mar 08 '26 13:03

Lakshmi D


1 Answers

Actually some time when you goes to find element, It would not be present on the DOM at that time due to slow internet or other reason, that's why are sometime able to click and sometime not.

To overcome this issue you should try using WebDriverWait with ExpectedConditions.elementToBeClickable to wait before click on element until element visible on the DOM and clickable as below :-

WebDriverWait wait = new WebDriverWait(driver, 10);
el = wait.until(ExpectedConditions.elementToBeClickable(By.id("kfiDocumentLink")));
el.click();
like image 150
Saurabh Gaur Avatar answered Mar 10 '26 14:03

Saurabh Gaur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!