TypeError:在Kubuntu 14.04上通过Selenium和Python执行测试时,urlopen()获得了关键字参数'body'的多个值 [英] TypeError: urlopen() got multiple values for keyword argument 'body' while executing tests through Selenium and Python on Kubuntu 14.04
本文介绍了TypeError:在Kubuntu 14.04上通过Selenium和Python执行测试时,urlopen()获得了关键字参数'body'的多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
im试图在Kubuntu 14.04上的python中运行硒. 我在尝试使用chromedriver或geckodriver时收到此错误消息,两者都是相同的错误.
im trying to run a selenium in python on Kubuntu 14.04. I get this error message trying with chromedriver or geckodriver, both same error.
Traceback (most recent call last):
File "vse.py", line 15, in <module>
driver = webdriver.Chrome(chrome_options=options, executable_path=r'/root/Desktop/chromedriver')
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py", line 318, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py", line 375, in execute
return self._request(command_info[0], url, body=data)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py", line 397, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/request.py", line 79, in request
**urlopen_kw)
File "/usr/lib/python3/dist-packages/urllib3/request.py", line 142, in request_encode_body
**urlopen_kw)
TypeError: urlopen() got multiple values for keyword argument 'body'
import time
import mapeamentos as map
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from random import randint
import datetime
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
driver = webdriver.Chrome(chrome_options=options, executable_path=r'/root/Desktop/chromedriver')
driver.get('http://192.168.1.11:66/webclient/login.html')
此错误在以下位置触发:
This error gets fired in:
driver = webdriver.Chrome()
我尝试使用选项,不使用选项,不使用带有路径的硬编码路径ou.
Ive tried with options, without options, without the hardcoded path ou with the path.
我不知道发生了什么事.谢谢大家.
I have no ideia what is happening. thanks everyone.
推荐答案
您可以使用
pip install --upgrade --ignore-installed urllib3
这篇关于TypeError:在Kubuntu 14.04上通过Selenium和Python执行测试时,urlopen()获得了关键字参数'body'的多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文