java - How to search for findElementBy.id in selenium webdriver -




i'm starting selenium webdriver. trying make simple example , button next on web: www.lot.com/pl/en.

webdriver driver = new firefoxdriver(); string web = "https://www.lot.com/pl/en/"; driver.get(web);  try{     driver.findelement(by.id("submit-booker") );     system.out.println("found"); }catch (exception e){     system.out.println("not found");     e.printstacktrace(); } 

but i'm not able work fine , gives me following error:

org.openqa.selenium.nosuchelementexception: unable locate element: #submit-booker

what doing wrong? how can fix it?

as trying click() on next button have span tag can consider construct unique xpath follows:

driver.findelement(by.xpath("//button[@id='submit-booker']/span") ); 




wiki

Comments

Popular posts from this blog

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -