Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Rahul Raut rahulmr

🏠
Working from home
View GitHub Profile
@rahulmr
rahulmr / env.rb
Created Sep 28, 2022 — forked from SarahElson/env.rb
How To Implement Data Tables In Cucumber Using Selenium Ruby
View env.rb
#/support/env.rb
require 'rubygems'
require 'watir'
Before do |scenario|
$browser = Watir::Browser.new :firefox
$browser.driver.manage.window.maximize
end
After do |scenario|
@rahulmr
rahulmr / ecommerce_steps.rb
Created Sep 28, 2022 — forked from SarahElson/ecommerce_steps.rb
How To Implement Data Tables In Cucumber Using Selenium Ruby
View ecommerce_steps.rb
#/step_definistions/ecommerce_steps.rb
Given(/^Ecommerce webpage Login Page loads$/) do
$browser.goto "https://ecommerce-playground.lambdatest.io/index.php?route=account/login"
$user_session = LoginPage.new
end
Then(/^Ecommerce Login Link is present loaded$/) do
assert($user_session.username_textbox.name, "email")
assert($user_session.password_textbox.name, "password")
end
@rahulmr
rahulmr / test_staleelement_chrome.py
Created Sep 28, 2022 — forked from SarahElson/test_staleelement_chrome.py
How To Handle Errors and Exceptions In Selenium Python
View test_staleelement_chrome.py
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>",
@rahulmr
rahulmr / test_nosuchelement_google.py
Created Sep 28, 2022 — forked from SarahElson/test_nosuchelement_google.py
How To Handle Errors and Exceptions In Selenium Python
View test_nosuchelement_google.py
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' : {
@rahulmr
rahulmr / test_nosuchelement_firefox.py
Created Sep 28, 2022 — forked from SarahElson/test_nosuchelement_firefox.py
How To Handle Errors and Exceptions In Selenium Python
View test_nosuchelement_firefox.py
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 Sep 28, 2022 — forked from SarahElson/LambdaTest Capabilities
How To Handle Errors and Exceptions In Selenium Python
View LambdaTest Capabilities
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 Sep 28, 2022 — forked from SarahElson/StaleElementReferenceException.py
How To Handle Errors and Exceptions In Selenium Python
View StaleElementReferenceException.py
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 Sep 28, 2022 — forked from SarahElson/locators.py
How To Download File Using Selenium Python?
View locators.py
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 Sep 28, 2022 — forked from SarahElson/test_download_file.py
How To Download File Using Selenium Python?
View test_download_file.py
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 Sep 28, 2022 — forked from SarahElson/conftest.py
How To Download File Using Selenium Python?
View conftest.py
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)