Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.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 如何在xpath中选择多个标记_Java_Selenium_Xpath_Html Table - Fatal编程技术网

Java 如何在xpath中选择多个标记

Java 如何在xpath中选择多个标记,java,selenium,xpath,html-table,Java,Selenium,Xpath,Html Table,请访问网站“” 除文本“池B”外,所有值都将被打印 有人能告诉我为什么没有选择“池B”文本吗 打印输出的代码: driver.get("cricbuzz.com/cricket-series/2223/icc-cricket-world-cup-2015/…); System.out.println(driver.findElement(By.xpath(" //h3/../table[1]/thead/tr/th")‌​).getText()); List<WebElement>

请访问网站“”

除文本“池B”外,所有值都将被打印 有人能告诉我为什么没有选择“池B”文本吗

打印输出的代码:

driver.get("cricbuzz.com/cricket-series/2223/icc-cricket-world-cup-2015/…); 
System.out.println(driver.findElement(By.xpath(" //h3/../table[1]/thead/tr/th")‌​).getText()); 
List<WebElement> tableHeading = driver.findElements(By .xpath("//h3/../table[1]/thead/tr/*[self: : tdorself: : th]")); 
for (int i = 1; i < tableHeading.size(); i++) 
{ 
   System.out.println(i+""+tableHeading.get(i).getText()); 
}
driver.get(“cricbuzz.com/cricket series/2223/icc-cricket-world-cup-2015/…);
System.out.println(driver.findElement(By.xpath(“//h3/。/table[1]/thead/tr/th”)‌​).getText());
List tableHeading=driver.findelelements(By.xpath(“//h3/./table[1]/thead/tr/*[self::tdorself::th]”);
对于(inti=1;i
在for循环中将索引设置为0:

for (int i = 0; i < tableHeading.size(); i++) 
{ 
   System.out.println(i+""+tableHeading.get(i).getText()); 
}
for(int i=0;i
它似乎在chrome中工作。您如何打印值,可以共享代码吗?System.out.println(driver.findelelement(By.xpath(//h3/./table[1]/thead/tr/th”)).getText();List tableHeading=driver.findelelements(By.xpath(//h3/./table[1]/thead/tr/*[self::td或self::th]”);for(int i=1;idriver.get("cricbuzz.com/cricket-series/2223/icc-cricket-world-cup-2015/…); System.out.println(driver.findElement(By.xpath(" //h3/../table[1]/thead/tr/th")‌​).getText()); List<WebElement> tableHeading = driver.findElements(By .xpath("//h3/../table[1]/thead/tr/*[self: : tdorself: : th]")); for (int i = 1; i < tableHeading.size(); i++) { System.out.println(i+""+tableHeading.get(i).getText()); }
for (int i = 0; i < tableHeading.size(); i++) 
{ 
   System.out.println(i+""+tableHeading.get(i).getText()); 
}