WebDriver - element is not clickable Chrome

前端 未结 8 1147
攒了一身酷
攒了一身酷 2021-02-04 10:56

I have following problem. I run test on Firefox and Chrome. On Firefox test run correctly but on Chrome SauceLabs give a message:

unknown error: Element is not          


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 11:14

    I was getting issue that login button is not clickable in chrome even xpath was correct. after browsing many sites, i came to the solution - use .submit() instead of .click() and it worked perfectly.

    driver.findElement(By.xpath("//button[@id='loginBtn']")).click();
    driver.findElement(By.xpath("//button[@id='loginBtn']")).submit();
    

提交回复
热议问题