我想用硒检查这个图像是否存在于页面上。我尝试了不同的方法,但每次我得到一个错误。喜欢 :
from matplotlib.pyplot import text
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium import webdriver
import time
sosyalkutu=[]
def sosyalkontrol(text):
if sosyalkutu.__contains__(str(text))==True:
return False
else:
sosyalkutu.append(text)
return True
username="hakkibulut"
op=Options()
op.add_experimental_option("debuggerAddress","localhost:8989")
driver= webdriver.Chrome(executable_path="C:\Python\\fiverr\\tiktoklive\\chromedriver.exe",chrome_options=op)
driver.get("http://tiktok.com/@"+username+"/live")
time.sleep(5)
while True:
for socialmess in driver.find_elements(By.XPATH,('//span[@src="https://p16-webcast.tiktokcdn.com/img/maliva/webcast-va/802a21ae29f9fae5abe3693de9f874bd~tplv-obj.png"]')):
print(socialmess.text)
但我收到“不是有效的 XPath 表达式”错误