java - In Selenium Webdriver, click button once the text is entered in text box -


i trying build selenium automation framework gmail. have installed below tools: jdk, eclipse, selenium jars, gradle, testng

i trying login gmail. cam getting below error time enter username. trying click "next" button before username entered.

can use wait ever required while developing framework? need maintain standards while calling wait. write user defined wait methods.

error: failed: gmailloginshouldbesuccessful org.openqa.selenium.elementnotvisibleexception: cannot click on element (warning: server did not provide stacktrace information) command duration or timeout: 207 milliseconds

my code:

@test public void gmailloginshouldbesuccessful(){     //1.go gmail website     system.setproperty("webdriver.ie.driver", "c:\\selenium_softwares_docs_videos\\iedriverserver_x64_3.1.0\\iedriverserver.exe");     webdriver driver = new internetexplorerdriver();     driver.manage().deleteallcookies();     driver.manage().window().maximize();     driver.get("http://gmail.com");          //2.fill in username     webelement usertextbox = driver.findelement(by.id("email"));     usertextbox.clear();     usertextbox.sendkeys("xxxx");     //3. click on next button     webelement nxtbtn = driver.findelement(by.id("next"));     nxtbtn.click();     //4.fill in password     webelement pwdtextbox = driver.findelement(by.id("passwd-hidden"));     usertextbox.clear();     usertextbox.sendkeys("xxxxxxx");     //5.click sign in     webelement signbtn = driver.findelement(by.id("signin"));     signbtn.click();         } 

you can use explicit wait achieve requirement.

webdriverwait wait = new webdriverwait(yourwebdriver, 5); wait.until(expectedconditions.elementtobeclickable(by.xpath("//xpath_to_element"))); 

webdriver wait 5 seconds element able clicked.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -