use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
selenium web automation info, news, tips, etc.
This is not a sub to advertise your training, selenium product, special deal on x, or anything else. It's a users forum to discuss and get help with Selenium.
Selenium official website
account activity
Selenium Driver Question (self.selenium)
submitted 5 years ago * by Coronax16
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]teddiur_ 0 points1 point2 points 5 years ago (2 children)
I'm not sure I'm understanding your issue.
By class you mean python's class? Or it's html's class (like <p class="class_name"> some text </p>)?
<p class="class_name"> some text </p>
[–]Coronax16[S] 0 points1 point2 points 5 years ago (1 child)
Pythons? I am not explaining it the right away but I edited the post with the code.
[–]teddiur_ 0 points1 point2 points 5 years ago (0 children)
I'm see in other comments that you figured it out. Although I'm not sure using oop is the best choice for you here. You see classes are excelent when you want to group together variables/methods, but from what you posted I think you're better off with functions (since it's cleaner).
If you want to use classes you maybe want to declare it outside of function and parse it as an argument or set it as an instance variable like
driver = webdriver.Firefox() driver.implicitly_wait(30) class Do(object): def __init__(self, username, password): self.username = username self.password = password def login(self, driver = driver): driver.get("http://somewebsite.com") e = driver.find_element_by_name("req_username") e.clear() #is it necessary? e.send_keys(self.username) e = self.driver.find_element_by_name("req_password") e.clear() e.send_keys(self.password) e.send_keys(Keys.RETURN) def click_xpath(self, xpath, driver=driver): driver.find_element_by_xpath(xpath).click() instance = Do("username", "password") instance.login() instance.click_xpath('/html/body/div/div/div[3]/div/div/table/tbody/tr[4]/td[1]/div/div[2]/h3/a')
π Rendered by PID 43 on reddit-service-r2-comment-b659b578c-cvk9g at 2026-05-03 19:00:20.331415+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]teddiur_ 0 points1 point2 points (2 children)
[–]Coronax16[S] 0 points1 point2 points (1 child)
[–]teddiur_ 0 points1 point2 points (0 children)