0
我只是想使用无头浏览器来运行这个函数,我不明白为什么它会一直抛出错误,即使我提供了参数。在这里,我已阅读,它需要论点options.add_argument通过(): - https://seleniumhq.github.io/selenium/docs/api/py/webdriver_firefox/selenium.webdriver.firefox.options.html#module-selenium.webdriver.firefox.options在无头模式下使用python运行firefox浏览器时出错3
错误: - 类型错误:add_argument()失踪1个人需要的位置参数: '参数'
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options.add_argument('-headless')
browser = webdriver.Firefox(options)
browser.get('https://intoli.com/blog/email-spy/')
browser.implicitly_wait(50)
heading = browser.find_element_by_xpath('//*[@id="heading-breadcrumb"]/div/div/div/h1').text
print(heading)
browser.close()
现在它显示这个错误 - 类型错误:listdir同时:路径应该是字符串,字节,OS。 PathLike或None,不是选项 – Rahul
检查我的更新。你应该真的遵循一些Python指南和一些硒教程,因为你犯的错误是非常基本的。 – Lescurel
是的,我正在学习和阅读,但一些错误,我不明白。谢谢你现在在工作 – Rahul