【问题标题】:Is chrome 84 webdriver compatible with selenium 3.141.0?chrome 84 webdriver 是否与 selenium 3.141.0 兼容?
【发布时间】:2023-03-13 17:09:01
【问题描述】:

我正在尝试使用 selenium 3.141.0 和 chrome 84 驱动程序的自动化项目。但是,尽管添加了正确的 id 和详细信息,但代码还是卡住了。我想知道是兼容性问题还是其他问题。

请帮帮我!

【问题讨论】:

    标签: python-3.x selenium selenium-webdriver selenium-chromedriver google-chrome-devtools


    【解决方案1】:

    是的,应该是 - 我尝试了 selenium 3.141.0 和 chrome 84 驱动程序(我从 https://sites.google.com/a/chromium.org/chromedriver/downloads 下载了 Mac 版本)并且它工作正常。

    您确定您的驱动程序与您的浏览器二进制文件兼容(这是我之前使用 selenium 时遇到的问题)?您收到的错误信息是什么?

    【讨论】:

      【解决方案2】:

      我正在做一个 FB 自动化项目。

      from selenium import webdriver

      from time import sleep

      driver=webdriver.Chrome(r'C:\Users\samar\OneDrive\Desktop\MAIN\projects\Jarvis\chromedriver.exe')

      driver.get('https://www.facebook.com')

      email=driver.find_element_by_xpath('.//*[@id="email"]')

      email.send_keys('username')

      password=driver.find_element_by_xpath('.//*[@id="pass"]')

      '''with open('pass.txt','r') as myfile: password1=myfile.read().replace('\n','')'''

      password.send_keys('password')

      login=driver.find_element_by_id('u_0_b')

      login.click()

      sleep(3)

      postarea=driver.find_element_by_xpath('//*[@id="mount_0_0"]/div/div[1]/div[1]/div[3]/div/div/div[1]/div[1]/div/div[2]/div/div/div[3]/div/div[2]/div/div/div/div[1]/div')

      postarea.click()

      sleep(3)

      activepostarea=driver.switch_to_active_element()

      activepostarea.send_keys("Hello World")

      但是登录后就到了FB主页。弹出一条消息,询问是否允许通知,即允许或阻止。然后出现以下错误。

      raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="mount_0_0"]/div/div[1]/div[1]/div[3]/div/div/div[1]/div[1]/div/div[2]/div/div/div[3]/div/div[2]/div/div/div/div[1]/div"} (Session info: chrome=84.0.4147.135)

      【讨论】:

      • 它找不到基于该 xpath 的元素。检查元素并复制 xpath ,确保它不在 iframe 中并关闭弹出窗口。
      • 如果xpath是正确的,那么关闭弹窗后会起作用吗?
      猜你喜欢
      • 2014-08-21
      • 1970-01-01
      • 2011-12-05
      • 2021-11-24
      • 2019-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      相关资源
      最近更新 更多