Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. using OpenQA.Selenium;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using NUnit.Framework;
  8. using OpenQA.Selenium.Chrome;
  9. using OpenQA.Selenium.PhantomJS;
  10.  
  11. namespace WebAuto
  12. {
  13. public class OpenBrowser
  14. {
  15. private static IWebDriver driver = new ChromeDriver();
  16.  
  17. public IWebDriver getDriver()
  18. {
  19. return driver;
  20. }
  21. }
  22. }
  23.  
  24. using OpenQA.Selenium;
  25. using System;
  26. using System.Collections.Generic;
  27. using System.Linq;
  28. using System.Text;
  29. using System.Threading.Tasks;
  30. using NUnit.Framework;
  31. using OpenQA.Selenium.Chrome;
  32. using OpenQA.Selenium.PhantomJS;
  33.  
  34.  
  35. namespace WebAuto
  36. {
  37. public class Login
  38. {
  39. public static void Login1()
  40. {
  41. //var driver = new ChromeDriver();
  42. OpenBrowser.IWebDriver. getDriver();
  43. driver.Navigate().GoToUrl("www.anywebsite.com");
  44. //driver.Navigate().GoToUrl("www.anywebsite.com");
  45. //driver.WaitForPageToLoad();
  46. var inputtext1 = driver.FindElement(By.Id("lgLogin_txtUserId"));
  47. //inputtext1.Focus();
  48. inputtext1.SendKeys("User");
  49. var inputpassword1 = driver.FindElement(By.Id("lgLogin_txtPassword"));
  50. //inputpassword1.Focus();
  51. inputpassword1.SendKeys("Password");
  52. var inputbutton1 = driver.FindElement(By.Id("btnLoginClient"));
  53. inputbutton1.Click();
  54. //driver.WaitForPageToLoad();
  55.  
  56. }
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement