In Framework self.driver.quit is nOT working for Fire fox | Selenium Python Forum
K
kam Posted on 11/06/2020

Following code is workingwith Chrome , but NOT in Firefox, it goes to else condition , which means look browser == NULL

 

def QUIT(self):
    if(self.driver!=NULL):
    print("CLOSING BROWSER :")
    time.sleep(2)
     self.driver.quit()
     print("BROWSER IS CLOSED :")

#else:
#print("CAN NOT CLOSE BROWSER :")


J
Jaspreet Replied on 11/06/2020

Hey, 

May you please share your project so that the issue can be checked.


K
kam Replied on 17/06/2020

Its Model 24 Part 15. I think code is very simple, and is working for CHROME , so no need to share project, for small thing

 


J
Jaspreet Replied on 16/07/2020

Hey, 

It is a possibility that the driver is not being passed to the fixture where you are calling the Quit function, kindly please check if the driver is being passed. If it is not then you have to create a object of the keywords class in fixture and using the object you have to call the quit function.

def base_fixture():
    with allure.step("Initializing Properties File...."):
        try:
            propertiesFile = open("D:\\eclipse\\DataDrivenFramework\\config.properties")
            prop.load(propertiesFile)
            #creating object of genKeywords class whre Quit function is defined
            gen = genkeywords()
        except FileNotFoundError as f:
            print(f)
    yield locals()
    with allure.step("Quitting as Tear Down Process...."):
        #using the same object to call the quit function
        gen.Quit()

Kindly please try to make this kind of structure and then try running your code.


Related Posts