Issue
I'm trying to create a class that inherits selenium's webdriver but I keep getting: TypeError: module() takes at most 2 arguments (3 given)
when I try to run it
class Exploring(webdriver): #i have also tried class Exploring(selenium.webdriver):
def __init__(self):
super().__init__()
self.chrome_options =chrome_options = webdriver.ChromeOptions()
self.chrome_options.add_experimental_option("detach", True)
self.driver = webdriver.Chrome(options=chrome_options)
self.driver.get('https://html-classic.itch.zone/html/7281144/dungeon-crawler-od-v1.1.3-browser/index.html')
def startup(self):
input_name = self.find_element(By.XPATH, '//*[@id="name-input"]')
input_name.click()
time.sleep(1)
input_name.send_keys("Vacine")
when I try running start-up in my main.py
I get a TypeError
in my class file:
explore = Exploring()
explore.startup()
I've done some searching of my own and I think its something to do with webdriver being a module but I'm unsure of how to fix it.
Solution
I think below is incorrect:
class Exploring(webdriver):
You should inherit Chrome
, so it should be:
class Exploring(webdriver.Chrome):
Answered By - Shawn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.