51Testing软件测试论坛

标题: chrome webdriver 版本时匹配的,执行以下脚本, 为何selenium报错如下 [打印本页]

作者: mendytoronto    时间: 2023-4-6 08:55
标题: chrome webdriver 版本时匹配的,执行以下脚本, 为何selenium报错如下
本帖最后由 mendytoronto 于 2023-4-6 09:01 编辑

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as Myservice
baseURL = "https://www.google.com"
service = Myservice(executable_path="C:\\Users\\mendy\\PycharmProjects\\selenimwb\\drivers")
driver = webdriver.Chrome(service=service)
driver.get(baseURL)
driver.implicitly_wait(10)

报错:
C:\python310\python.exe C:/Users/mendy/PycharmProjects/selenimwb/basicweb/openChrome.py
Traceback (most recent call last):
  File "C:\Users\mendy\PycharmProjects\selenimwb\basicweb\openChrome.py", line 6, in <module>
    driver = webdriver.Chrome(service=service)
  File "C:\python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 80, in __init__
    super().__init__(
  File "C:\python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 101, in __init__
    self.service.start()
  File "C:\python310\lib\site-packages\selenium\webdriver\common\service.py", line 104, in start
    self.assert_process_still_running()
  File "C:\python310\lib\site-packages\selenium\webdriver\common\service.py", line 115, in assert_process_still_running
    return_code = self.process.poll()
AttributeError: 'Service' object has no attribute 'process'


作者: oliver.tang    时间: 2023-5-30 15:53
driver 与 谷歌浏览器版本不一致




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2