Confirming that the website's navigation and menu are simple to use, clear, and allow users to quickly find what theyre looking for without experiencing any errors.
Language: Java
Framework: Selenium 4
1//Assumptions: 2//1. The Shopify webpage is accessible and functional. 3//2. The website has a standard navigation and menu structure. 4//3. Chrome webdriver is installed on local machine.56//Imports7import org.openqa.selenium.By;8import org.openqa.selenium.WebDriver;9import org.openqa.selenium.WebElement;10import org.openqa.selenium.chrome.ChromeDriver;1112public class ShopifyNavigationTest {1314 public static void main(String[] args) {1516 //Set Chrome webdriver location17 System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");1819 //Create new Chrome driver20 WebDriver driver = new ChromeDriver();2122 //Connect to remote client with desired capabilities23 /* DesiredCapabilities capabilities = DesiredCapabilities.chrome();24 capabilities.setCapability("version", "79");25 capabilities.setCapability("platform", "Windows 10");26 WebDriver driver = new RemoteWebDriver(new URL("http://remote-host:4444/wd/hub"), capabilities); */2728 //Navigate to Shopify webpage29 driver.get("https://www.shopify.com/");3031 //Find and click on menu button32 WebElement menuButton = driver.findElement(By.xpath("//button[@aria-label='Toggle navigation']"));33 menuButton.click();3435 //Find and click on Products menu item36 WebElement productsMenuItem = driver.findElement(By.xpath("//a[@href='/products']"));37 productsMenuItem.click();3839 //Verify that Products page is loaded40 if(driver.getCurrentUrl().equals("https://www.shopify.com/products")) {41 System.out.println("Products page is successfully loaded.");42 } else {43 System.out.println("Failed to load Products page.");44 }4546 //Close the browser47 driver.quit();48 }49}
Language: Python
Framework: Selenium 4
1from selenium import webdriver2from selenium.webdriver.common.keys import Keys3from selenium.webdriver.common.by import By4from selenium.webdriver.support.ui import WebDriverWait5from selenium.webdriver.support import expected_conditions as EC67# Assume the website URL is available in the baseURL variable8baseURL = "https://www.shopify.com/"910# Create a local driver for Selenium with the Chrome Browser11driver = webdriver.Chrome()1213# Uncomment the following lines to connect to a remote client with desired capabilities14# from selenium.webdriver.common.desired_capabilities import DesiredCapabilities15# desired_capabilities = DesiredCapabilities.CHROME.copy()16# driver = webdriver.Remote(17# command_executor='your_remote_server_url',18# desired_capabilities=desired_capabilities19# )2021# Navigate to the website's baseUrl22driver.get(baseURL)2324# Find the navigation and menu items on the webpage25navigation = driver.find_element_by_css_selector(".site-nav__link").text2627# Check if the navigation and menu structure is simple to use and clear28assert navigation != "", "Navigation is empty"29assert "Menu" in navigation, "Menu option is missing"3031# Wait for the page to load completely32wait = WebDriverWait(driver, 10)33element = wait.until(EC.presence_of_element_located((By.ID, "footer")))3435# Close the browser window36driver.close()
Disclaimer: Following code snippets and related information have been sourced from GitHub and/or generated using AI code generation tools. LambdaTest takes no responsibility in the accuracy of the code and is not liable for any damages.
Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.
Test Intelligently and ship faster. Deliver unparalleled digital experiences for real world enterprises.
Start Free Testing