Best Python code snippet using pytest-mozwebqa_python
test_01.py
Source:test_01.py
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)...
add_menber_page1.py
Source:add_menber_page1.py
1from selenium import webdriver2from selenium.webdriver.common.by import By3from web.test_selenium2.page.base_page1 import BasePage4from web.test_selenium2.page.contact_page1 import Contact5from selenium.webdriver.chrome.options import Options6class AddMember(BasePage):7 _username = "username"8 def add_member(self):9 self.find(By.ID,self._username).send_keys("ä¸å·´1")10 self.find(By.ID,"memberAdd_acctid").send_keys("000002")11 self.find(By.ID,"memberAdd_phone").send_keys("13543333332")12 self.find(By.CSS_SELECTOR,".js_btn_save").click()13 return Contact(self.driver)14 def add_member_fail(self):15 self.find(By.ID,self._username).send_keys("ä¸å·´2")16 self.find(By.ID,"memberAdd_acctid").send_keys("000002")17 self.find(By.ID,"memberAdd_phone").send_keys("13543333332")18 self.find(By.CSS_SELECTOR,".js_btn_save").click()19 self.find(By.CSS_SELECTOR, ".js_btn_cancel").click()...
main_page1.py
Source:main_page1.py
1from selenium import webdriver2from selenium.webdriver.common.by import By3from web.test_selenium2.page.add_menber_page1 import AddMember4from web.test_selenium2.page.base_page1 import BasePage5from web.test_selenium2.page.contact_page1 import Contact6class MainPage(BasePage):7 _base_url = "https://work.weixin.qq.com/wework_admin/frame#index"8 def goto_add_member(self):9 self.find(By.CSS_SELECTOR,".index_service_cnt_itemWrap:nth-child(1)").click()10 return AddMember(self.driver)11 def goto_contact(self):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!