Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在selenium中打开测试选项卡的子选项卡_Java_Html_Selenium_Selenium Webdriver - Fatal编程技术网

Java 如何在selenium中打开测试选项卡的子选项卡

Java 如何在selenium中打开测试选项卡的子选项卡,java,html,selenium,selenium-webdriver,Java,Html,Selenium,Selenium Webdriver,我正在尝试打开博客选项卡的子选项卡。我尝试测试博客页面中所有主题的可点击性 这是页面的标题代码 这是我的密码 import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;

我正在尝试打开博客选项卡的子选项卡。我尝试测试博客页面中所有主题的可点击性 这是页面的标题代码

这是我的密码


import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class BlogTestEN {
//143
// /html/body/section/div[2]/div[1]/div/div[1]/ul/li/a  
    public static void main(String[] args) {

        System.setProperty("webdriver.firefox.driver",
                "C:\\\\Users\\\\Abdullah Kandilli\\\\eclipse-workspace\\\\Selenium.maven.demo\\\\chromedriver.exe");

        //Initiating your chromedriver
        WebDriver driver=new ChromeDriver();

        driver.get("https://www.rentnconnect.com/blog");
        //driver.findElement(By.xpath("/html/body/header/div/div[3]/div/div/div[2]/div/form/span[2]/div[1]/div/div/div[1]/input")).sendKeys("Turkey",Keys.ENTER);
        //driver.executeScript("window.history.go(-1)");
        for(int i = 1; i<144; i+= 2) {
            driver.manage().timeouts().implicitlyWait(1500, TimeUnit.SECONDS);
            driver.findElement(By.xpath("/html/body/section/div[2]/div[1]/div/div["+i+"]")).click();
            driver.manage().timeouts().implicitlyWait(1500, TimeUnit.SECONDS);
            driver.navigate().back();
            driver.manage().timeouts().implicitlyWait(1500, TimeUnit.SECONDS);

        }



    }
}

导入java.util.concurrent.TimeUnit;
导入org.openqa.selenium.By;
导入org.openqa.selenium.Keys;
导入org.openqa.selenium.WebDriver;
导入org.openqa.selenium.chrome.ChromeDriver;
公共类博客测试{
//143
///html/body/section/div[2]/div[1]/div/div[1]/ul/li/a
公共静态void main(字符串[]args){
System.setProperty(“webdriver.firefox.driver”,
“C:\\\\Users\\\\Abdullah Kandilli\\\\eclipse工作区\\\\Selenium.maven.demo\\\\chromedriver.exe”);
//启动你的chromedriver
WebDriver驱动程序=新的ChromeDriver();
驱动程序。获取(“https://www.rentnconnect.com/blog");
//driver.findelelement(By.xpath(“/html/body/header/div/div[3]/div/div/div/div[2]/div/form/span[2]/div[1]/div/div/div[1]/input”).sendKeys(“土耳其”,key.ENTER);
//driver.executeScript(“window.history.go(-1)”;

对于(int i=1;我在setProperty中编写了错误的驱动程序,但ı将驱动程序更改为chrome。同样的问题。感谢您可能希望提供类似于快照的内容,这使得使用实际DOM更加容易。我在setProperty中编写了错误的驱动程序,但ı将驱动程序更改为chrome。同样的问题。感谢您可能希望提供一些类似于ike是一个快照,这使得使用实际DOM变得非常简单。