internet explorer - Switching between user name and password text box and entering corresponding values using Selenium WebDriver java -


I am using Selenium to navigate to a page and take screenshots using Internet Explorer. But the problem is that login is taken care of by the Javascript warning box. Now there is a feature in Selenium where the focus can be brought in the warning box using the warning element and I have managed to bring focus and entered some values ​​in the username text box.

The problem is that the Selenium password does not focus on the text box and enters the user name and password in the same box. I tried the Java AWT robot to click on the tab key and this focus changed, but Selenium does not recognize it and it records the username and password in the same box.

Below is my code:

  robot robot = new robot (); Driver.get ("url"); Warning Warning = Driver. SwitchTo (). Warning (); Alert.sendKeys ("user name"); Robot.keyPress (KeyEvent.VK_TAB); Alert.sendKeys ("password"); Alert.accept ();   

What am I missing here? Is my attitude correct or do I have to take a different route?

Remarks on the Hi-Madness Another Switch Method.

  robot robot = new robot (); Warning Warning = DR.switchTo (). Warning (); Dr.get ("the url"); Alert.sendKeys ("user name"); //dr.switchTo () warning () .; Robot.keyPress (KeyEvent.VK_TAB); Alert.sendKeys ("password"); Alert.accept ();    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -