From 5b3ecf2f22724147036635d8163e010e5994402d Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 15 Jan 2025 14:37:26 -0600 Subject: [PATCH 1/2] example code for southernglazers --- main-southernglazers.py | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 main-southernglazers.py diff --git a/main-southernglazers.py b/main-southernglazers.py new file mode 100644 index 0000000..9cc4aec --- /dev/null +++ b/main-southernglazers.py @@ -0,0 +1,59 @@ +from selenium import webdriver +from selenium.webdriver.common.by import By + +from selenium.webdriver import ActionChains +from selenium.webdriver.common.action_chains import ActionChains + +import time + +# ARRANGE +driver = webdriver.Chrome() +driver.implicitly_wait(2.0) + +navUrlHome = 'https://www.southernglazers.com/' +expTitleHomePage = "Southern Glazer's" +expArtURL = 'https://www.southernglazers.com/careers/culture' + +cssJoinTeam = '#navigation-2f1eadac33-cta-megaMenu-3' # css selector is fragile +xpathJoinTeam = '//*[@title="Join the team"]' +xpathCulture = '//*[@title="Culture"]' +xpathNewsTalking = '//div[@id="so-good-that-people-are-talking"]' +xpathNewsFeatured = '//h2[contains(text(), "Featured News")]' +xpathBtnCloseOneTrust = '//*[@id="onetrust-close-btn-container"]' + + +# ACT +# navigate to site +driver.get(navUrlHome) +title = driver.title + +# ASSERT +# Check title text +assert title == expTitleHomePage , "Issue: Title mismatch. Exp: " + expTitleHomePage + " Found: " + title + + +# ACT +# close onetrust +driver.find_element(By.XPATH, xpathBtnCloseOneTrust).click() + +# find and click on culture page +drpdwnJoinTeam = driver.find_element(By.XPATH, xpathJoinTeam) +actions = ActionChains(driver) +actions.move_to_element(drpdwnJoinTeam).perform() +time.sleep(2) ## demo use only. I hate sleep functions + +linkCulture = driver.find_element(By.XPATH, xpathCulture) +linkCulture.click() +time.sleep(2) ## demo only: pause to watch screen :) + +# scroll down page "" +elNewsTalking = driver.find_element(By.XPATH, xpathNewsTalking) +driver.execute_script("arguments[0].scrollIntoView();",elNewsTalking ) +time.sleep(4) ## demo only: pause to watch screen :) + + +# ASSERT +print(driver.current_url) +assert driver.current_url == expArtURL, "ISSUE: unexpected URL Exp: " + expArtURL + " Found: " + driver.current_url + +driver.quit() \ No newline at end of file From 986d697877d7195996abbc2454020a87f6ca15fa Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 22 Jan 2025 08:45:06 -0600 Subject: [PATCH 2/2] southerglazers example code --- .../main-southernglazers.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main-southernglazers.py => ExamplesProcedural/main-southernglazers.py (100%) diff --git a/main-southernglazers.py b/ExamplesProcedural/main-southernglazers.py similarity index 100% rename from main-southernglazers.py rename to ExamplesProcedural/main-southernglazers.py