Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.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
使用Selenium Python查找所有类_Python_Selenium - Fatal编程技术网

使用Selenium Python查找所有类

使用Selenium Python查找所有类,python,selenium,Python,Selenium,嗨,我想知道如何通过类名获取元素,其中每个类都部分相同 class=光标挣钱\页面\按钮配置文件\视图\图像\ xxxx,其中xxxx未定义 我只想从这个类名profile\u view\u img\u xxxx获取所有图像 如果是纵断面图img 32487或纵断面图img 86732或纵断面图img 3278324,您可以使用: driver.find_elements_by_xpath("//*[contains(@class,"cursor earn_pages_button profil

嗨,我想知道如何通过类名获取元素,其中每个类都部分相同

class=光标挣钱\页面\按钮配置文件\视图\图像\ xxxx,其中xxxx未定义

我只想从这个类名profile\u view\u img\u xxxx获取所有图像

如果是纵断面图img 32487或纵断面图img 86732或纵断面图img 3278324,您可以使用:

driver.find_elements_by_xpath("//*[contains(@class,"cursor earn_pages_button profile_view_img_")]").
它将用该文本匹配所有类。只需尝试使用for循环对其进行迭代。

应该是驱动程序。find_元素…但您有find_元素,而不是find_元素,它不会返回所有元素。