Closed ghost closed 1 year ago
import pytest from selenium import webdriver from selenium.webdriver.common.by import By
class Test1:
@pytest.fixture() def setup(self): self.url = "https://www.saucedemo.com/" # create webdriver object self.driver = webdriver.Chrome() self.driver.get(self.url) yield @pytest.fixture() def teardown(self): yield self.url = "https://www.saucedemo.com/" self.driver = webdriver.Chrome() self.driver.get(self.url) def test_clic_login_btn(self, setup, teardown): self.driver.find_element(By.ID, 'login-button').click() assert self.driver.current_url == self.url, "Aplicacao nao esta na pagina de login" error_message = self.driver.find_element(By.CLASS_NAME, 'error-message-container').text assert error_message == 'Epic sadface: Username is required', "Mensagem de error invalida!!" self.driver.quit()
import pytest from selenium import webdriver from selenium.webdriver.common.by import By
class Test1: