from selenium import webdriver
myList = ['Artik']
driver = webdriver.Firefox() # or .Chrome()
driver.get('www.theWebsite.com')
current = driver.find_element_by_xpath('//span[@class="ipo-TeamStack_TeamWrapper"]').text
if current in myList:
print('YAY')
driver.quit()
此返回WebElement列表包含“Artik”。
参数(如'Artik')区分大小写。你知道吗
如果你确信“阿蒂克”只是其中一个
这将找到带有“Artik”的WebElement并单击。你知道吗
这就是如何通过selenium中的xpath查找元素。我在这里使用Firefox,但你也可以使用Chrome。你知道吗
相关问题 更多 >
编程相关推荐