Guest User

Untitled

a guest
Feb 11th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. IWebElement clickUsername = driver.FindElement(By.XPath("//input[@name='tbUsername']"));
  2. clickUsername.Click();
  3. clickUsername.SendKeys("MyUsername");
  4.  
  5.  
  6. IWebElement clickPassword = driver.FindElement(By.XPath("//input[@name='tbPassword']"));
  7. clickPassword.Click();
  8. clickPassword.SendKeys("Mypassword");
  9.  
  10. <div class="inputbg">
  11. THIS IS VISIBLE => <input id="dummypassword" class="input" type="text" onfocus="this.style.display='none';document.getElementById('pw').style.display='inline';document.getElementById('pw').focus()" value="Password" tabindex="2" name="dummypassword">
  12. THIS IS INVISIBLE => <input id="pw" class="input" type="password" onblur="if(this.value==''){this.style.display='none';document.getElementById('dummypassword').style.display='inline'}" onkeypress="if (event.keyCode==13)fmLogin.submit();" value="" style="display: none;" tabindex="2" name="tbPassword" autocomplete="off">
  13. </div>
  14.  
  15. IWebElement clickPassword = driver.FindElement(By.Id("dummypassword"));
  16. clickPassword.Click();
  17.  
  18. IWebElement realPasswordInput = driver.FindElement(By.XPath("//input[@name='tbPassword']"));
  19. realPasswordInput.SendKeys("Mypassword");
  20.  
  21. allTextBoxes = driver.FindElements(By.Id("username"));
  22. var allPasswordTextBoxes = driver.FindElements(By.Id("password"));
  23.  
  24. var userNameTextField = allTextBoxes.Count > 0 ? allTextBoxes[1] : allTextBoxes[0];
  25. userNameTextField.SendKeys("myUsername");
  26.  
  27. var passwordTextField = allPasswordTextBoxes.Count > 0 ? allPasswordTextBoxes[1] : allPasswordTextBoxes[0];
  28. passwordTextField.SendKeys("myPassword");
Add Comment
Please, Sign In to add comment