internet explorer - Switching between user name and password text box and entering corresponding values using Selenium WebDriver java -
i using selenium navigate page , take screenshots using internet explorer. problem login taken care javascript alert box. selenium has facility focus can brought alert box using alert element , have managed bring focus , enter values in user name text box.
the problem selenium not switch focus password text box , enters username , password in same box. tried java awt robot click on tab key , changes focus, selenium not recognized , continues entering user name , password in same box.
below code:
robot robot = new robot(); driver.get("the url"); alert alert = driver.switchto().alert(); alert.sendkeys("username"); robot.keypress(keyevent.vk_tab); alert.sendkeys("password"); alert.accept();
what missing here? approach here correct or have take different route?
hi madusudanan try code commenting switch method.
robot robot = new robot(); alert alert=dr.switchto().alert(); dr.get("the url"); alert.sendkeys("username"); //dr.switchto().alert(); robot.keypress(keyevent.vk_tab); alert.sendkeys("password"); alert.accept();
Comments
Post a Comment