I'm new in Selenium and WebDriver. I have this HTML:
<input id="undefined-undefined-Jobsubject-5546" type="text" value="" data-test="testing-job-subject" style="padding: 0px; position: relative; width: 100%; border: medium none; outline: medium none; background-color: transparent; color: rgb(255, 255, 255); cursor: initial; font: inherit; height: 100%; box-sizing: border-box; margin-top: 14px;"/>
and I have this code:
driver.findElement(By.xpath("//input[@data-test='testing-job-subject']"));
but the error is:
org.openqa.selenium.NoSuchElementException: Unable to locate element: //input[@data-test='testing-job-subject']
I tried also this:
driver.findElement(By.xpath("//*[starts-with(@id,'undefined-undefined-Jobsubject')]"));
because the number in id is generated, so I can't take the By.id(....), but the same error. And yes,I have in the code the timeouts,so the element is on the page.
Where is the problem? Thanks