Skip to content

Instantly share code, notes, and snippets.

@SarahElson
SarahElson / tests_test_smartwait.py
Created June 7, 2024 06:07
How to Wait in Python: Python Wait Tutorial With Examples
import pytest
from pages.smartwait import *
@pytest.mark.usefixtures("driver")
def test_blog_navigation(driver):
smartwait = SmartWait(driver)
smartwait.click_blog_link()
smartwait.click_first_post()
assert "amet volutpat" in driver.title, "Expected 'amet volutpat' in title"
@SarahElson
SarahElson / smartwait_option.py
Created June 7, 2024 06:06
How to Wait in Python: Python Wait Tutorial With Examples
option_smartwait = {
"platform": "macOS Sonoma",
"version": "latest",
"name": "Selenium Pytest",
"Build": "Python Wait Selenium Build",
"smartWait": 10, # It accepts integer values as second
"video": True,
"visual": False,
"network": True,
"console": True,
@SarahElson
SarahElson / tests_test_fluent_wait.py
Created June 7, 2024 05:59
How to Wait in Python: Python Wait Tutorial With Examples
import pytest
from pages.fluent_wait import *
from selenium.webdriver.support.wait import WebDriverWait
@pytest.mark.usefixtures("driver")
def test_fluent_wait(driver):
fluent_wait = FluentWait(driver)
@SarahElson
SarahElson / tests_test_explicit_wait.py
Created June 7, 2024 05:37
How to Wait in Python: Python Wait Tutorial With Examples
import pytest
from pages.explicit_wait import *
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@pytest.mark.usefixtures("driver")
def test_explicit_wait_email_input(driver):
@SarahElson
SarahElson / tests_test_implicit_wait.py
Created June 7, 2024 05:27
How to Wait in Python: Python Wait Tutorial With Examples
import pytest
from pages.implicit_wait import *
@pytest.mark.usefixtures("driver")
def test_implicit_wait(driver):
implicit_wait = ImplicitWait(driver)
implicit_wait.click_my_account()
@SarahElson
SarahElson / tests_test_sleep_wait.py
Created June 7, 2024 05:14
How to Wait in Python: Python Wait Tutorial With Examples
import pytest
from selenium.webdriver.common.by import By
from pages.sleep_wait import *
import time
@pytest.mark.usefixtures("driver")
def test_sleep_wait(driver):
@SarahElson
SarahElson / TestFindAllElementByTagName.java
Created June 6, 2024 07:30
How To Get Element by Tag Name in Selenium
package CloudGrid;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
@SarahElson
SarahElson / TestFindFirstElementByTagName.java
Created June 6, 2024 07:10
How To Get Element by Tag Name in Selenium
package CloudGrid;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
public class TestFindFirstElementByTagName extends BaseTest {
@SarahElson
SarahElson / BaseTest.java
Created June 6, 2024 06:54
How To Get Element by Tag Name in Selenium
package CloudGrid;
import java.net.*;
import java.util.HashMap;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.*;
@SarahElson
SarahElson / pom.xml
Created June 6, 2024 06:53
How To Get Element by Tag Name in Selenium
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>GetElementByTagNameSelenium</groupId>
<artifactId>GetElementByTagNameSelenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>GetElementByTagNameSelenium</name>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>