How to use test_selenium1 method in pytest-mozwebqa

Best Python code snippet using pytest-mozwebqa_python

14practice.py

Source:14practice.py Github

copy

Full Screen

1# TODO Selenium 1 基础+进阶✅2"""14-2 selenium IDE 录制✅"""3# 13-15Web/14BasicSelenium/test_ide.py4"""14-4 等待✅"""5# 显示等待、隐式等待、直接等待6# 显示等待自定义until函数7# ../14BasicSelenium/test_selenium1.py8"""14-5 定位✅"""9# xpath定位->console✅10# $x("//*[id='s_tab']//a(1)")11# $x("//*[id='s_tab']//a(last())")12# CSS定位->console✅13# $("#s_tab a:nth-child(2)")14"""14-6 进阶✅️"""15# ActionChains16# 1 click、double_click、context_click✅17# 13-15Web/14BasicSelenium/test_js.py18# 2 move_to_element✅19# 13-15Web/14BasicSelenium/test_selenium1.py20# 3 drag_and_drop✅21# 13-15Web/14BasicSelenium/test_js.py22from selenium import webdriver23from selenium.webdriver import ActionChains24from time import sleep25driver = webdriver.Chrome()26driver.implicitly_wait(5)27driver.get("http://sahitest.com/demo/dragDropMooTools.htm")28action = ActionChains(driver)29ele1 = driver.find_element_by_id("dragger")30ele2 = driver.find_element_by_css_selector(".item:nth-child(4)")31action.drag_and_drop(ele1, ele2).perform()32sleep(3)33driver.quit()34# 4 key_down、key_up、Keys.CONTROL…✅35# 13-15Web/14BasicSelenium/test_js.py36# TouchActions✅37# 13-15Web/14BasicSelenium/test_selenium1.py38"""14-7 frame✅"""39# 多窗口✅40# 13-15Web/14BasicSelenium/test_selenium1.py41# test_window42# frame✅43# 13-15Web/15_1-3Notes/test_inputfile_alert.py44"""14-8 兼容性测试✅"""45# 13-15Web/14BasicSelenium/test_selenium2.py46"""14-9 js✅"""47# console✅48"""491.页面弹窗50window.alert("hello world")512.页面性能52JSON.stringify(performance.timing)533.页面标题54document.title554.页面属性值56document.getElementById("kw").value575.滑动页面58document.documentElement.scrollTop596.去掉属性值60a = document.getElementById("train_date")61a.removeAttribute("readonly")62a.value = "2000-02-02"63"""64# selenium脚本✅...

Full Screen

Full Screen

test_01.py

Source:test_01.py Github

copy

Full Screen

1from selenium.webdriver import Chrome2import pytest3a=1014@pytest.mark.skip("Don't want to execute this one")5def test_Selenium():6 path="C://Users//ramadhma//Selenium//chromedriver.exe"7 driver=Chrome(executable_path=path)8 driver.get("https://www.facebook.com/")9@pytest.mark.skipif(a>100, reason="Don't want to execute this one")10def test_Selenium1():11 path="C://Users//ramadhma//Selenium//chromedriver.exe"12 driver=Chrome(executable_path=path)13 driver.get("https://www.facebook.com/")14#test_Selenium()15def test_Selenium2():16 path="C://Users//ramadhma//Selenium//chromedriver.exe"17 driver=Chrome(executable_path=path)18 driver.get("https://www.facebook.com/")19@pytest.mark.Smoke20def test_Selenium():21 path="C://Users//ramadhma//Selenium//chromedriver.exe"22 driver=Chrome(executable_path=path)23 driver.get("https://www.facebook.com/")24@pytest.mark.Sanity25def test_Selenium1():26 path="C://Users//ramadhma//Selenium//chromedriver.exe"27 driver=Chrome(executable_path=path)28 driver.get("https://www.facebook.com/")29#test_Selenium()30@pytest.mark.Smoke31def test_Selenium2():32 path="C://Users//ramadhma//Selenium//chromedriver.exe"33 driver=Chrome(executable_path=path)...

Full Screen

Full Screen

test_Assertion.py

Source:test_Assertion.py Github

copy

Full Screen

1from selenium.webdriver import Chrome2import pytest3@pytest.mark.skip4def test_Selenium():5 path="C://Users//ramadhma//Selenium//chromedriver.exe"6 driver=Chrome(executable_path=path)7 driver.get("https://www.facebook.com/")8 assert driver.title== "Facebook login"9def test_Selenium1():10 path="C://Users//ramadhma//Selenium//chromedriver.exe"11 driver=Chrome(executable_path=path)12 driver.get("https://www.facebook.com/")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-mozwebqa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful