Я только что обновил свой selenium-python с 3.4.3 до 3.5.0, и больше нет необходимости возиться с возможностями.

отаю на компьютере с Windows 10, Internet Explorer 11, Python 3.6, Селен 3.4.3 с IEDriverServer 3.5. Я пытаюсь открыть IE, используя следующий код.

from selenium import webdriver
import os


driverLocation = "C:\\Users\\JD\\PycharmProjects\\Lib\\IEDriverServer.exe"
os.environ["webdriver.ie.driver"] = driverLocation
driver = webdriver.Ie(driverLocation)
google = "https://google.com"
driver.get(google)

Выход:

Traceback (most recent call last):
  File "C:/Users/J/PycharmProjects/Automation/IE_Test.py", line 7, in <module>
    driver = webdriver.Ie(driverLocation)
  File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 57, in __init__
    desired_capabilities=capabilities)
  File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Invalid capabilities in alwaysMatch: unknown capability named platform

Любая помощь будет принята с благодарностью.

ОБНОВЛЕНИЕ: я добавил это в мой предыдущий код,

capabilities = DesiredCapabilities.INTERNETEXPLORER
print(capabilities["platform"])
print(capabilities["browserName"])

ВЫХОД:

WINDOWS
internet explorer
 File "C:\Users\JD\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Invalid capabilities in alwaysMatch: unknown capability named platform

ОБНОВЛЕНИЕ: Я также попытался установить возможности, но все еще получаю ту же ошибку: «неизвестные возможности назвали платформу

caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps["platform"] = "WINDOWS"
caps["browserName"] = "internet explorer"
caps["requireWindowFocus"] = True
browser = webdriver.Ie(capabilities=caps,
                       executable_path="C:\\Users\\JD\\PycharmProjects\\Lib\\IEDriverServer.exe")
browser.get("https://www.facebook.com/")

Ответы на вопрос(1)

Ваш ответ на вопрос