I'm running a selenium file with the following code in python and I keep having a traceback call error. I can't tell what the problem is. Below is the error I keep having:
Traceback (most recent call last): File "C:\Users\Whizzy.Ellah\PycharmProjects\virtual_assistant_final_year_project\selenium_web.py", line 2, in from selenium import webdriver File "C:\anacondaF\envs\finalYrProject\lib\site-packages\selenium\webdriver_init_.py", line 18, in from .firefox.webdriver import WebDriver as Firefox # noqa File "C:\anacondaF\envs\finalYrProject\lib\site-Traceback (most recent call last): File "C:\Users\Whizzy.Ellah\PycharmProjects\virtual_assistant_final_year_project\selenium_web.py", line 2, in from selenium import webdriver File "C:\anacondaF\envs\finalYrProject\lib\site-packages\selenium\webdriver_init_.py", line 18, in from .firefox.webdriver import WebDriver as Firefox # noqa File "C:\anacondaF\envs\finalYrProject\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 26, in from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver File "C:\anacondaF\envs\finalYrProject\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 40, in from .remote_connection import RemoteConnection File "C:\anacondaF\envs\finalYrProject\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 26, in import urllib3 ModuleNotFoundError: No module named 'urllib3'
Process finished with exit code 1
import time
from selenium import webdriver
from selenium.webdriver import chrome
class web_driver_info():
def __int__(self):
self.driver = webdriver.Chrome(executable_path=r'C:\\Users\\Whizzy.Ellah\\PycharmProjects\\virtual_assistant_final_year_project\\chromedriver.exe')
def get_info(self, query):
self.query = query
self.driver.get(url='https://www.wikipedia.org')
class_instance = web_driver_info()
class_instance.get_info("Hello")
CodePudding user response:
Either urllib3 is not imported or not installed.
To import, use
import urllib3
at the top of the file. To install write:
pip install urllib3
into terminal.
CodePudding user response:
Apart from the two reasons mentioned by @Ankit_Gunner
in their answer that:
Either urllib3 is not imported or not installed.
There can be another possibility as follows:
urllib3
orrequests
module is backdated and needs a update.
In that case you need to upgrade urllib3
/ requests
module as:
Using
pip
:pip install --upgrade requests
Using
pip3
:pip3 install --upgrade requests