Best Python code snippet using SeleniumBase
cw22_lesson.py
Source:cw22_lesson.py
...13# "div.service-offers__list > "14# ":nth-of-type(4).service-offers__unit.ng-scope .service-offers__data "15# "[data-ng-if='::searchTasksItem.data.deadline']")16# assert element_click.text == "Ðо 17 декабÑÑ 2021"17def test_demo_site(page_thedemosite_driver):18 name = "Anton"19 email = "test@mail.ru"20 current_address = "Moskov dubrovka"21 permanent_address = "Moskov random street"22 el_fullname = page_thedemosite_driver.find_element(By.ID, "userName")23 el_fullname.send_keys(name)24 el_email = page_thedemosite_driver.find_element(By.CSS_SELECTOR, "#userEmail")25 el_email.send_keys(email)26 el_current_address = page_thedemosite_driver.find_element(By.CSS_SELECTOR, "#currentAddress")27 el_current_address.send_keys(current_address)28 el_permanent_address = page_thedemosite_driver.find_element(By.CSS_SELECTOR, "#permanentAddress")29 el_permanent_address.send_keys(permanent_address)30 sub_button = page_thedemosite_driver.find_element(By.CSS_SELECTOR, "#submit")31 sub_button.click()...
test.py
Source:test.py
...4 5 def open_url(self, url, path):6 self.open(url + path)7 time.sleep(1)8 def test_demo_site(self):9 10 # Prod11 url = "https://madrid.quintype.io/"12 prod_paths = ["technology/drivezy-to-liquidate-its-fleet-as-demand-falls-amid-virus-outbreak", "culture/india/pursuitsbugatti-centodieci-revives-spirit-of-eb110-photos-specs-price", 13 "tech/mobile/trai-chief-we-set-spectrum-price-industry-decides-tariff", "culture/this-is-a-title-9", "technology/youtube-now-available-for-jiophone"]14 15 for i in prod_paths:16 self.open_url(url, i)17 18 # Staging19 url_stg = "https://malibu-integration-web.qtstage.io/"20 stg_paths = ["whatever/imported-story-1-should-get-published-4", "whatever/headline-09837232647442259", "whatever/headline-09710416993351383", 21 "whatever/headline-09369913954141263", "with-new-story-slug-format"]22 ...
test_demo_site.py
Source:test_demo_site.py
234class MyTestClass(BaseCase):56 def test_demo_site(self):7 # self.open("https://seleniumbase.io/demo_page.html")8 # self.open("https://www.nike.com/kr/launch/t/men/fw/nike-sportswear/DD1401-200/tcxo48/nike-dunk-hi-retro-prm")910 self.open("https://www.nike.com/kr/launch/t/women/fw/nike-sportswear/CU1450-500/dlva36/w-nike-fontanka-edge")1112 self.driver.implicitly_wait(10)13 # aa = self.assert_text("COMING SOON", timeout=10)1415 # print("exist ", aa)16
...
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!!