FrontEnd tests are performed with the objective of verifying that each DOM title corresponds to each assertEqual implemented
# Script made in Windows OS
# Only for Chrome Browser
# PyCharm IDE
# Python 3.10
import time
import pytest
from faker import Faker
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
options = Options()
options.add_argument('--start-maximized')
options.add_argument('--incognito')
#options.add_experimental_option("excludeSwitches", ["enable-automation"])
#options.add_experimental_option('useAutomationExtension', False)
options.binary_location = 'C:/Program Files/Google/Chrome/Application/chrome.exe'
dc = DesiredCapabilities.CHROME
dc['goog:loggingPrefs'] = {'browser':'ALL'}
driver = webdriver.Chrome(chrome_options=options, executable_path='D:/Drivers/chromedriver.exe', desired_capabilities=dc)
fake = Faker('es_ES')
@pytest.mark.feature("SetUp")
class TestOpenHome:
def test_openHome(self):
driver.get('https://antonio-rodriguez.tech')
driver.maximize_window()
assert 'Antonio Rodriguez' in driver.title
time.sleep(1)
for e in driver.get_log('browser'):
print(e)
# Close configuracion de cookies
def test_closeCookies(self):
"""Close cookies settings"""
cookies = driver.find_element(By.CLASS_NAME,'onetrust-close-btn-handler')
cookies.click()
time.sleep(0.5)
@pytest.mark.feature("TearDown")
class TestTearDown:
# Close driver
def test_tearDown(self):
"""Close driver"""
driver.quit()
