元素不可见错误,我尝试了所有的Xpath,css选择器,id,类和名称,但没有任何工作。我尝试过以前的解决方案,但仍未解决

时间:2017-06-13 06:14:21

标签: automated-tests

我也尝试了所有Xpathcss selectoridclassname,但没有任何效果。我尝试过以前的解决方案,但它没有解决问题:

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Frontend {

    public static void main(String args[])
    {

        System.setProperty("webdriver.chrome.driver", "D:\\chromedriverlatest.exe");
        WebDriver driver=new ChromeDriver();
        driver.get("https://genba.online");
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        driver.manage().window().maximize();
        driver.findElement(By.xpath("//*[@id='en-btn']")).click();//translate to english language
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        driver.findElement(By.xpath("/html/body/div/div[1]/div/div/div[1]/div[1]/div/div[2]/div/a[2]")).click();//click on access button
        driver.findElement(By.xpath("//*[@id='email']")).sendKeys("a@b.com");
        driver.findElement(By.xpath("//*[@id='password']")).sendKeys("123456");
        driver.findElement(By.xpath("//*[@id='rememberme']")).click();
        driver.findElement(By.xpath("//*[@id='user_detail']/div[2]/div[2]/button")).click();

    }

}

0 个答案:

没有答案