我运行一个查询到一个网页和selenium打开页面,我等待,直到所有的脚本加载。然后我执行一个标记搜索,到目前为止,我已经尝试了每一种方法,但它总是返回selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".dowload"}
即使该元素在页面上可见并显示在Inspect选项卡上。
代码如下:
from selenium.webdriver.common.by import By
from selenium.webdriver import Chrome, ChromeOptions
from time import sleep
options = ChromeOptions()
# options.addargument("--headless=new")
driver = Chrome(options=options)
driver.set_page_load_timeout(10.0)
Sike = "https://www.instagram.com/"
downloadLink = 'https://gotaku1.com/download?id=OTA3OTk=&typesub=Gogoanime-DUB&title=Death+Note+%28Dub%29+Episode+1'
driver.get(Sike)
sleep(5)
driver.execute_script(f'''window.open("{downloadLink}","_blank");''')
driver.execute_script(f'''window.open("{downloadLink}","_blank");''')
driver.execute_script(f'''window.open("{downloadLink}","_blank");''')
sleep(10)
tags = driver.find_element(By.CLASS_NAME, 'dowload')
print(tags)
instagram的链接就在那里没有理由
1条答案
按热度按时间eit6fx6z1#
您正在打开多个(3)标签页,但Selenium试图在第一个打开的标签页(instagram.com)上查找元素