1

I am trying to inherit browser class in test. Can someone please point out what am i doing wrong here. I am new to python

This is my test class where I am trying to inherit browser class

import unittest
from Configurations.Browser import Browser
class GoogleTest(Browser):
    def test_homepage(self):
        driver = self.driver
        self.driver.implicitly_wait(10) self.driver.find_element_by_xpath("/html/body/div/div[4]/form/div[2]/div[1]/div[1]/div/div[2]/input").send_keys("Test")

Browser.py:

import unittest
from selenium import webdriver
class Browser(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox(executablepath=r"C:\Setups\Selenium\Drivers\geckodriver.exe")
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        self.driver.get("https://www.google.com")
    def tearDown(self):
        if(self.driver != None):
            self.driver.close()
            self.driver.quit()
    if __name__ == '__main__':
        unittest.main()

1 Answer 1

2

You have to change the "excutablepath" to "executable_path".(Browser.py)

like this

self.driver = webdriver.Firefox(executable_path=r"C:\Setups\Selenium\Drivers\geckodriver.exe")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.