Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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
Css 获取最后一个类型的实际第n个类型位置_Css_Selenium_Highcharts - Fatal编程技术网

Css 获取最后一个类型的实际第n个类型位置

Css 获取最后一个类型的实际第n个类型位置,css,selenium,highcharts,Css,Selenium,Highcharts,这就是我的问题。我想使用Selenium遍历HighCharts中折线图的每个点。我想出了一种从(1)类型的path:n开始到path:last的方法。然而,它是从右到左的,我希望它是从左到右的(我知道我是peaky)。 因此,如果我能找到一种从类型的最后一个开始到类型(1)的第n个的方法,我将非常高兴。但是,我不知道如何获得最后一个类型的第n个类型(位置),以便在每次循环时将其减少1。 以下是迄今为止我掌握的代码(从右到左): 您可以为此使用findElements: int count =

这就是我的问题。我想使用Selenium遍历HighCharts中折线图的每个点。我想出了一种从(1)类型的path:n开始到path:last的方法。然而,它是从右到左的,我希望它是从左到右的(我知道我是peaky)。 因此,如果我能找到一种从类型的最后一个开始到类型(1)的第n个的方法,我将非常高兴。但是,我不知道如何获得最后一个类型的第n个类型(位置),以便在每次循环时将其减少1。

以下是迄今为止我掌握的代码(从右到左):


您可以为此使用
findElements

int count = driver.findElements(By.cssSelector("g.highcharts-series-group > g:nth-of-type(2) > path:last-of-type")).size();

然后使用
计数
向后迭代。

谢谢,这就是我要找的!
int count = driver.findElements(By.cssSelector("g.highcharts-series-group > g:nth-of-type(2) > path:last-of-type")).size();