Python Forum
Getting import error when trying to import Selenium
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting import error when trying to import Selenium
#1
from selenium import webbrowser

webbrowser.get(
    "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
).open("https://www.geeksforgeeks.org")


button = webbrowser.find_element_by_class_name("slide-out-btn")

button.click()
I am using selenium

Output/errors: Traceback (most recent call last):
File "C:/Users/Abdul_szuzdge/PycharmProjects/untitled/project2.py", line 4, in <module>
from selenium import webbrowser
ImportError: cannot import name 'webbrowser' from 'selenium' (C:\Users\Abdul_szuzdge\PycharmProjects\untitled\venv\lib\site-packages\selenium\__init__.py)

Process finished with exit code 1

What I am trying too do: I am trying to make the script go to the site 'https://www.geeksforgeeks.org' and click the button
P.S: I am new to python

*I am using PyCharm*
Reply
#2
it's webdriver, not webbrowser
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask_table module compatibility issue: cannot import name 'Markup' from 'flask' venkateshbalagiri 1 414 Mar-22-2024, 05:07 AM
Last Post: venkateshbalagiri
  flask.cli.NoAppException: Could not import 'app' kazu755 4 4,825 Feb-19-2023, 01:50 PM
Last Post: Larz60+
  How do I use shortcut to import class in VS code? cheers100 0 1,606 Nov-28-2020, 08:11 AM
Last Post: cheers100
  Import data in Python from PHP adm00 0 1,545 Oct-09-2020, 03:29 PM
Last Post: adm00
  Selenium weird error julio2000 0 1,682 Feb-23-2020, 01:24 PM
Last Post: julio2000
  Python can't import Django and it's in the site-packages directory karkas 3 8,210 Feb-11-2020, 02:59 AM
Last Post: menator01
  Selenium webdriver error WiPi 4 12,168 Feb-09-2020, 11:38 AM
Last Post: WiPi
  error when running headless selenium julio2000 2 4,585 Feb-01-2020, 12:41 PM
Last Post: julio2000
  Error clicking button with selenium julio2000 4 5,368 Jan-06-2020, 10:59 AM
Last Post: julio2000
  Selenium error with ebdriver (geckodriver) Martinelli 4 4,757 Sep-24-2019, 01:40 AM
Last Post: Martinelli

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020