Skip to content

Instantly share code, notes, and snippets.

@muditlambda
Created May 5, 2020 14:19
Show Gist options
  • Save muditlambda/bad61f42304c40d9bab9b4d4ee96dfdb to your computer and use it in GitHub Desktop.
Save muditlambda/bad61f42304c40d9bab9b4d4ee96dfdb to your computer and use it in GitHub Desktop.
#Implementation of Selenium test automation for this Selenium Python Tutorial
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
def test_lambdatest_todo_app():
chrome_driver = webdriver.Chrome()
chrome_driver.get('https://lambdatest.github.io/sample-todo-app/')
chrome_driver.maximize_window()
chrome_driver.find_element_by_name("li1").click()
chrome_driver.find_element_by_name("li2").click()
title = "Sample page - lambdatest.com"
assert title == chrome_driver.title
sample_text = "Happy Testing at LambdaTest"
email_text_field = chrome_driver.find_element_by_id("sampletodotext")
email_text_field.send_keys(sample_text)
sleep(5)
chrome_driver.find_element_by_id("addbutton").click()
sleep(5)
output_str = chrome_driver.find_element_by_name("li6").text
sys.stderr.write(output_str)
sleep(2)
chrome_driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment