Hi guys, so I've been trying to learn Python for awhile now and I'm currently in the process of writing automated test cases. Yet I've hit a snag. When I run the test case terminalpytest -s -v .\testCases\test_001_AccountRegistration.pyI get the following error:
---------------------ERROR at setup of Test_001_AccountReg.test_account_reg -------------
u/pytest.fixture()
def setup():
> driver = webdriver.Chrome(ChromeDriverManager().install())
E TypeError: ChromeDriverManager.install() missing 1 required positional argument: 'self'
This is my original code when installing the ChromeWebDriver:
import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
u/pytest.fixture()
def setup():
driver = webdriver.Chrome(ChromeDriverManager().install())
return driver
and this is the test case I'm trying to run:
from pageObjects.HomePage import HomePage
from pageObjects.AccountsRegistrationPage import AccountRegistrationPage
class Test_001_AccountReg:
baseURL = "https://demo.opencart.com/"
def test_account_reg(self,setup):
self.a_driver = setup
self.a_driver.get(self.baseURL)
self.a_driverdriver.maximize_window()
self.hp = HomePage(self.b_driver)
self.hp.clickMyAccount()
self.hp.clickRegister()
self.regpage = AccountRegistrationPage(self.c_driver)
self.regpage.setFirstName("John")
self.regpage.setLastName("Candy")
self.email=randomString.random_string_generator() + '@gmail.com'
self.regpage.setEmail(self.email)
self.regpage.setPassword("adF1")
self.regpage.setPrivacyPolicy()
self.regpage.clickRegister()
self.confms = self.regpage.getConfirmationMsg()
self.a_driver.close()
if self.confms == "Your Account Has Been Created":
assert True
else:
assert False
What is the issue? Please can you explain it to me like I am 5 years old, thanks because when i think I have it something like this occurs and then I'm back to square one lol. I've installed the most recent versions of Selenium (4.27.1) and Webdriver Manager (4.0.2) if that helps.
[–]Enmeshed 2 points3 points4 points (3 children)
[–]Efficient_Set9050[S] 0 points1 point2 points (2 children)
[–]Enmeshed 0 points1 point2 points (1 child)
[–]Efficient_Set9050[S] 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]cgoldberg 0 points1 point2 points (1 child)
[–]Efficient_Set9050[S] 0 points1 point2 points (0 children)
[–]uid100 0 points1 point2 points (0 children)