Skip to content

Instantly share code, notes, and snippets.

@SarahElson
SarahElson / test_nosuchelement_google.py
Last active September 28, 2022 16:05
How To Handle Errors and Exceptions In Selenium Python
import pytest
from selenium import webdriver
import sys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
# Desired Capabilities according to SELENIUM 4
ch_capabilities = {
'LT:Options' : {
@SarahElson
SarahElson / test_nosuchelement_firefox.py
Last active September 28, 2022 16:04
How To Handle Errors and Exceptions In Selenium Python
import pytest
from selenium import webdriver
import sys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
# Desired Capabilities according to SELENIUM 4
ff_capabilities = {
'LT:Options' : {
"user" : "<username>",
@SarahElson
SarahElson / Selenium_Python_classes.py
Last active September 15, 2022 08:13
How To Handle Errors and Exceptions In Selenium Python
import pytest
from selenium import webdriver
import sys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException
@SarahElson
SarahElson / LambdaTest Capabilities
Created July 21, 2022 06:13
How To Handle Errors and Exceptions In Selenium Python
ch_capabilities = {
'LT:Options': {
"user": "<username>",
"accessKey": "<accesskey>",
"build": "StaleElementReferenceException Test on Chrome",
"name": "StaleElementReferenceException Test on Chrome",
"platformName": "Windows 10"
},
"browserName": "Chrome",
"browserVersion": "102.0",
@SarahElson
SarahElson / Remote Selenium Grid
Created July 21, 2022 06:16
How To Handle Errors and Exceptions In Selenium Python
def test_ecommerceplayground_staleelement():
# LambdaTest Profile username
user_name = "<username>"
# LambdaTest Profile access_key
app_key = "<accesskey>"
# Remote Url to connect to our instance of LambdaTest
remote_url = "https://" + user_name + ":" + \
app_key + "@hub.lambdatest.com/wd/hub"
# creating an instance of Chrome based on the remote url and the desired capabilities
ch_driver = webdriver.Remote(
@SarahElson
SarahElson / StaleElementReferenceException.py
Last active October 24, 2022 10:13
How To Handle Errors and Exceptions In Selenium Python
import pytest
from selenium import webdriver
import sys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException
ch_capabilities = {
'LT:Options' : {
"user" : "<username>",
"accessKey" : "<accesskey>",
@SarahElson
SarahElson / Implementation
Last active July 29, 2022 10:01
How To Maximize Browser In Selenium Ruby
require 'selenium-webdriver'
require 'test-unit'
class BrowserWindowTests < Test::Unit::TestCase
def setup
username = "#{ENV['LAMBDATEST_USERNAME']}"
access_token = "#{ENV['LAMBDATEST_ACCESS_KEY']}"
grid_url = "hub.lambdatest.com/wd/hub"
capabilities = {
@SarahElson
SarahElson / Implementation (Test Scenario – 1)
Last active July 29, 2022 10:01
Getting Started With Selenium Python [Tutorial]
#Implementation of Selenium WebDriver with Python using PyTest
import pytest
from selenium import webdriver
import sys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from time import sleep
saf_capabilities = {
"build" : "Porting test to LambdaTest Selenium Grid (Safari)",
"name" : "Porting test to LambdaTest Selenium Grid (Safari)",
@SarahElson
SarahElson / BaseTest.js
Last active September 15, 2022 11:29
Complete Tutorial On Appium Parallel Testing [With Examples]
public class BaseTest {
protected DriverManager driverManager;
@Parameters ("deviceId")
@BeforeClass (alwaysRun = true)
public void setupTest (final String deviceId) {
this.driverManager = DriverManager.builder ()
.deviceId (deviceId)
.build ()
@SarahElson
SarahElson / Pom.xml
Last active July 29, 2022 10:00
Complete Tutorial On Appium Parallel Testing [With Examples]
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng-version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>