vendredi 27 mars 2020

JavaScript xPath command does not run co-mingled with Selenium Java program on every run

The below javascript (co-mingled with Java in Selenium) does not run xpath command successfully on every run. However my Java command runs successfully, it's the xpath that I'm having issues with. (In other words, sometimes xpath command runs successfully and at other times it does not). I changes jdk from 13 to jdk8, and that didn't work. I don't know what's needed.

I'm new with learning automation testing and I'm teaching myself.

Here's the command line:

driver.findElement(By.xpath("//button[@type='button' and @data-test-id='checkbox']")).click();

Error response:

JavaScript error: , line 0: NotAllowedError: The play method is not
allowed by the user agent or the platform in the current context,
possibly because the user denied permission.
Exception in thread "main"
org.openqa.selenium.StaleElementReferenceException: The element
reference of <button class="c27KHO0_n b_0 M_0 i_0 I_T y_Z2uhb3X
A_6EqO r_P C_q cvhIH6_T ir3_1JO2M7 P_0" type="button"> is stale;
either the element is no longer attached to the DOM, it is not
in the current frame context, or the document has been refreshed

Aucun commentaire:

Enregistrer un commentaire