Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当Chrome更新时,Selenium停止工作_Python_Selenium - Fatal编程技术网

Python 当Chrome更新时,Selenium停止工作

Python 当Chrome更新时,Selenium停止工作,python,selenium,Python,Selenium,我把浏览器从Chrome75升级到了77,现在我的代码已经停止工作了——这是在更新Selenium驱动程序之后——它仍然运行,只是没有像以前那样运行 我编写了一个程序来获取车辆注册检查器,将其输入政府注册检查器,并返回与该注册相关的汽车的三位数据 在注册被接受后,它似乎不会进入页面,即单击“是”然后继续的页面 我试图删除try和except条款,这些条款似乎可以解决这个问题。。。但这会毁了我想做的事 def vehicleRegChecker(vehicleReg): from sel

我把浏览器从Chrome75升级到了77,现在我的代码已经停止工作了——这是在更新Selenium驱动程序之后——它仍然运行,只是没有像以前那样运行

我编写了一个程序来获取车辆注册检查器,将其输入政府注册检查器,并返回与该注册相关的汽车的三位数据

在注册被接受后,它似乎不会进入页面,即单击“是”然后继续的页面

我试图删除try和except条款,这些条款似乎可以解决这个问题。。。但这会毁了我想做的事

def vehicleRegChecker(vehicleReg):

    from selenium import webdriver

    try:
        driver = webdriver.Chrome()
        driver.get("https://vehicleenquiry.service.gov.uk/ConfirmVehicle")
        driver.find_element_by_name("Vrm").send_keys(vehicleReg)


        python_button = driver.find_elements_by_xpath("//button[@name='Continue'][@type='submit']")[0]
        python_button.click()

        python_button = driver.find_elements_by_xpath("//input[@data-val='true'][@type='radio']")[0]
        python_button.click()

        python_button = driver.find_elements_by_xpath("//button[@name='Continue'][@type='submit']")[0]
        python_button.click()

        fuel_type = driver.find_element_by_id('FuelTypeShown').text
        years_of_manufacture = driver.find_element_by_xpath('//li[.//*[contains(text(), "Year of manufacture")]]//strong').text
        cc = driver.find_element_by_xpath('//*[@id="CylinderCapacity"]//strong').text

        print(fuel_type)
        print(years_of_manufacture)
        print(cc)

#        driver.quit()

        return([vehicleReg,fuel_type, years_of_manufacture, cc])

    except Exception:

#        driver.quit()

        return([vehicleReg, "vehicle not found"])

您可能使用的是与Chrome77不兼容的旧ChromeDriver版本。看哪个说:

如果您使用的是Chrome 77版,请下载


您可能使用的是与Chrome77不兼容的旧ChromeDriver版本。看哪个说:

如果您使用的是Chrome 77版,请下载

下载适合你的,对于chrome 77,这是最后的选择


下载一个适合你的,对于chrome 77,这是最后一个选择

我做了很抱歉我应该解释一下-当我离开时仍然不起作用,除了clauseit似乎没有通过这个阶段-web窗口被卡住了:python\u button=driver.find\u elements\u by\u xpath(//input[@data val='true'][@type='radio']”[0]python_按钮。click()我做了很抱歉我应该解释一下-当我离开try时仍然不起作用,除了clauseit似乎没有通过这个阶段之外-web窗口被卡住了:python_按钮=驱动程序。通过xpath(//input[@data val='true'][@type='radio'])[0]python_按钮。单击()