0
我试图用下面的代码执行此操作。它应该转到https://www.google.co.jp/并点击侧边菜单上的YouTube
链接。Python Selenium - 尝试点击链接时出现'ElementNotVisibleException'错误
import time
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
google=driver.get("https://www.google.co.jp/")
youtube=WebDriverWait(driver,300)
.until(EC.presence_of_element_located
((By.XPATH,".//*[@id='tsf']/div[2] /div[3]/center/input[2]")))
youtube.click()
它返回此错误:
[[ElementNotVisibleException]] ERROR
没有关于语言的问题。你写的东西已经可以理解了。我现在改进了一下,并且在开始时删除了道歉,因为语法正常。祝你好运! – Bobby