Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require( 'chromedriver' );
  2.  
  3. let webdriver = require( 'selenium-webdriver' ),
  4.     By = webdriver.By,
  5.     until = webdriver.until;
  6.  
  7. let driver = new webdriver.Builder( )
  8.     .forBrowser( 'chrome' )
  9.     .build( );
  10.  
  11. const userEmail = 'olenahoncharenko1994@gmail.com';
  12. const userPassword = '455515558a'
  13.  
  14. driver.get( 'https://my.novaposhta.ua/auth/index');
  15.  
  16. driver.manage( ).addCookie({name:"PHPSESSID", value:"bf3c318ac6cc5a19bc38ee44a64f8b92"});
  17. driver.manage( ).addCookie({name:"DeviceCode", value:"d99f0301ca5666a56d033f5f5176dcb6"});
  18.  
  19. driver.get('https://my.novaposhta.ua/auth/index');
  20.  
  21. driver.manage().getCookie('PHPSESSID').then(function (cookie) {
  22.    console.log(cookie);
  23. });
  24.  
  25.  
  26. function wait(locator, time) {
  27.     const button = driver.wait( until.elementLocated( locator ),
  28.     time = 20000
  29.     );
  30.     button.click( );
  31. }
  32.  
  33. wait( By.xpath('//div/input[@data-type="person"]') );
  34.  
  35. driver.findElement( By.name( 'LoginForm[username]') ).sendKeys(userEmail);
  36. driver.findElement( By.name( 'LoginForm[password]') ).sendKeys(userPassword);
  37. driver.findElement(By.name( 'yt0') ).click( );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement