【发布时间】:2022-01-22 21:08:53
【问题描述】:
我想查找页面上所有包含单词“card”或单词“bag”的按钮。
例如它可以是“添加到卡片”或“添加到袋子”或“卡片”等。
from selenium import webdriver
from selenium.webdriver.support.color import Color
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome(executable_path = ChromeDriverManager().install())
driver.get('https://www.inshoes.gr/andrikes-zones-andrikes-zones-dermatines-diplis-opseos-33000481-kamel-mavro')
buttons=driver.find_element_by_xpath('//button[normalize-space()="Click me!"]')
for button in buttons:
print (button)
【问题讨论】:
-
例如它可以是“添加到卡片”或“添加到袋子”或“卡片”等 - 您正在查看哪些按钮,请指定它们。
标签: python selenium button xpath text