This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")', |