java - Unable to locate webelement in popup window -


i having trouble automating test on website https://casino.efortuna.ro/en/

whatever do, selenium not able find inputs username/password

i have tried driver.switchto().activeelement() , driver.switchto().frame(0) , nothing seems working.

this code supposed find them , fill them fail

"no such element: unable locate element: {"method":"xpath","selector":"//*[@id="view389"]/div/div/div[2]/div/div[2]/div/form/div[1]/div[1]/div/input"}"

public casinomainpage openloginform() {         webelement loginbtn = driver.findelement(by.xpath("//*[@id=\"application\"]/div[3]/div[1]/div[4]/div[1]/div/div/div[2]/div[2]/button"));         loginbtn.click();         return this;     }          public casinomainpage fillusername(string username) {         webelement loginfield = driver.findelement(by.xpath("//*[@id=\"view389\"]/div/div/div[2]/div/div[2]/div/form/div[1]/div[1]/div/input"););         loginfield.sendkeys(username);         return this;     }      public casinomainpage fillpassword(string password) {         webelement passwordfield = driver.findelement(by.xpath("//*[@id=\"view185\"]/div/div/div[2]/div/div[2]/div/form/div[1]/div[2]/div/input"););         passwordfield.sendkeys(password);         return this;     }    //this method called @test , fails on fillusername()  public casinomainpage login() {         gotomainpage();         waitfor(by.xpath("//*[@id=\"application\"]/div[3]/div[1]/div[4]/div[1]/div/div/div[2]/div[2]/button");,const.default_timeout);         openloginform();         driver.switchto().activeelement();         fillusername("login");         fillpassword("password");         commitlogin();         return this;     } 

can please me? can't find out doing wrong. in advance.

here answer question:

you can consider change following:

  1. login button on homepage:

    webelement loginbtn = driver.findelement(by.xpath("//button[@class='btn btn_action_login btn_size_small fn-login']")); 
  2. username field:

    webelement loginfield = driver.findelement(by.name("username")); 
  3. password field:

    webelement passwordfield = driver.findelement(by.name("password")); 
  4. log in button:

    webelement log_in = driver.findelement(by.xpath("//button[@class='btn fn-login-btn btn_type_popup-login']")); 

let me know if answers question.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -