为什么程序总是打开http://--port=57883/ 通过Selenium Python使用IEDriverServer IE

为什么程序总是打开http://--port=57883/ 通过Selenium Python使用IEDriverServer IE,python,selenium,internet-explorer,selenium-iedriver,iedriverserver,Python,Selenium,Internet Explorer,Selenium Iedriver,Iedriverserver,代码试用: import time from selenium import webdriver from selenium.webdriver.ie.options import Options url = 'www.google.com' def Login(): browser = webdriver.Ie(executable_path=r'C:\Program Files\Internet Explorer\iexplore.exe') browser.implicit

代码试用:

import time
from selenium import webdriver
from selenium.webdriver.ie.options import Options
url = 'www.google.com'
def Login():
    browser = webdriver.Ie(executable_path=r'C:\Program Files\Internet Explorer\iexplore.exe')
    browser.implicitly_wait(5)
    browser.get(url)
    print(browser.title)
    browser.find_element_by_id("register").click()
    time.sleep(9)
    browser.implicitly_wait(5)
    browser.get(url)
    time.sleep(9)
    browser.quit()

Login()
当我在终端中运行这个python文件时,它总是跳转到指定名称的页面(http://--port=57583/) 我不知道为什么


20191125增补 当我运行login.py时 新的错误正在出现

Traceback (most recent call last):
  File "C:/Users/ou/PycharmProjects/accessw/login.py", line 32, in <module>
    ie()
  File "C:/Users/ou/PycharmProjects/accessw/login.py", line 14, in ie
    browser.get(url)
  File "C:\Users\ou\PycharmProjects\accessw\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\ou\PycharmProjects\accessw\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\ou\PycharmProjects\accessw\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Specified URL (www.google.com) is not valid.
我需要创建一个名为iexplore.exe的DWORD(32位均为)值,其值为0 是一个参数,用户可以通过该参数传递IEDriverServer二进制文件的绝对路径,以覆盖用于启动IE会话的IEDriverServer二进制文件的系统路径

因此,在调用键可执行路径时,您需要传递

browser = webdriver.Ie(executable_path=r'C:\\Utility\\BrowserDrivers\\IEDriverServer.exe')
get()
方法必须在url中包含协议。所以你应该改变:

url = 'www.google.com'
致:


可能重复的好,我明白了,但一个新的问题出来了。(这是WebDriver服务器的初始起始页。)在默认情况下显示上述消息之前,您需要导航到有效的url。我明白了。我设置了错误的注册表项(Regedit 64位窗口)
browser = webdriver.Ie(executable_path=r'C:\\Utility\\BrowserDrivers\\IEDriverServer.exe')
url = 'www.google.com'
url = 'http://www.google.com'