Skip to content

Instantly share code, notes, and snippets.

View rahulmr's full-sized avatar
🏠
Working from home

Rahul Raut rahulmr

🏠
Working from home
View GitHub Profile
@rahulmr
rahulmr / test_nosuchelement_firefox.py
Created September 28, 2022 16:04 — forked from SarahElson/test_nosuchelement_firefox.py
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>",
@rahulmr
rahulmr / LambdaTest Capabilities
Created September 28, 2022 16:04 — forked from SarahElson/LambdaTest Capabilities
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",
@rahulmr
rahulmr / StaleElementReferenceException.py
Created September 28, 2022 16:03 — forked from SarahElson/StaleElementReferenceException.py
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>",
@rahulmr
rahulmr / locators.py
Created September 28, 2022 16:03 — forked from SarahElson/locators.py
How To Download File Using Selenium Python?
from selenium.webdriver.common.by import By
class SeleniumPlaygroundPageLocators(object):
#locators
file_download = (By.XPATH, '//li[.="File Download"]')
data_field = (By.XPATH, '//*[@id="textbox"]')
generate_file = (By.ID, 'create')
download_button = (By.XPATH, '//*[@id="link-to-download"]')
@rahulmr
rahulmr / test_download_file.py
Created September 28, 2022 16:02 — forked from SarahElson/test_download_file.py
How To Download File Using Selenium Python?
import unittest
from tests.conftest import Browser
from pages.selenium_playground_page import *
# I am using python unittest for asserting cases.
class TestDownloadFile(Browser):
def test_download(self):
page = Selenium_Playground_Page(self.driver)
download_file = page.download("How to download files using Selenium & Python?")
@rahulmr
rahulmr / conftest.py
Created September 28, 2022 16:00 — forked from SarahElson/conftest.py
How To Download File Using Selenium Python?
import unittest
from selenium import webdriver
class Browser(unittest.TestCase):
def setUp(self):
PATH = "/Users/macbookair/Desktop/how_download_files_selenium_python/download"
#Mozilla Firefox
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", PATH)
@rahulmr
rahulmr / Implementation (Test Scenario – 1).py
Created September 28, 2022 16:00 — forked from SarahElson/Implementation (Test Scenario – 1).py
Selenium Python Tutorial: A Python Automation Testing Guide with examples
#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)",
@rahulmr
rahulmr / testScripts -parallelSignup.py
Created September 28, 2022 15:57 — forked from SarahElson/testScripts -parallelSignup.py
Playwright Python Tutorial
from playwright.sync_api import sync_playwright
import sys
sys.path.append(sys.path[0] + "/..")
from elementSelectors.registrationPageSelectors import elementSelector
from testCapabilities.testCaps import testCapabilities
select = elementSelector()
import sys
sys.path.append(sys.path[0] + "/..")
from testScripts.parallelSignup import Register
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
try:
@rahulmr
rahulmr / registrationPageSelectors.py
Created September 28, 2022 15:51 — forked from SarahElson/registrationPageSelectors.py
Playwright Python Tutorial: Getting Started With Python End To End Testing
webElements = {
'webpage': "https://ecommerce-playground.lambdatest.io/index.php?route=account/register",
'First_Name': 'input[placeholder="First Name"]',
'Last_Name': 'input[placeholder="Last Name"]',
'E-Mail': 'input[placeholder="E-Mail"]',
'Telephone': 'input[placeholder="Telephone"]',
'Password': 'input[placeholder="Password"]',
'Confirm_Password': 'input[placeholder="Password Confirm"]',
'Subscribe': 'label:has-text("No")',
'Privacy_Policy': 'label:has-text("I have read and agree to the Privacy Policy")',