Best Python code snippet using SeleniumBase
lesson1.6_step5.py
Source:lesson1.6_step5.py
1import math2from selenium import webdriver3import time 4link = "http://suninjuly.github.io/find_link_text"5try:6 browser = webdriver.Chrome()7 browser.get(link)8 find_link_text = browser.find_element_by_link_text(str(math.ceil(math.pow(math.pi, math.e)*10000)))9 find_link_text.click()10 input1 = browser.find_element_by_tag_name("input")11 input1.send_keys("Ivan")12 input2 = browser.find_element_by_name("last_name")13 input2.send_keys("Petrov")14 input3 = browser.find_element_by_class_name("city")15 input3.send_keys("Smolensk")16 input4 = browser.find_element_by_id("country")17 input4.send_keys("Russia")18 button = browser.find_element_by_css_selector("button.btn")19 button.click()20finally:21 # ÑÑпеваем ÑкопиÑоваÑÑ ÐºÐ¾Ð´ за 30 ÑекÑнд22 time.sleep(30)23 # закÑÑваем бÑаÑÐ·ÐµÑ Ð¿Ð¾Ñле вÑеÑ
манипÑлÑÑий24 browser.quit()...
lesson6_step5.py
Source:lesson6_step5.py
1from Main import Main2browser = Main().getChrome()3import time4import math5find_link_text = "http://suninjuly.github.io/find_link_text"6try:7 browser.get(find_link_text)8 link = browser.find_element_by_link_text(str(math.ceil(math.pow(math.pi, math.e) * 10000)))9 link.click()10 input1 = browser.find_element_by_tag_name("input")11 input1.send_keys("Ivan")12 input2 = browser.find_element_by_name("last_name")13 input2.send_keys("Petrov")14 input3 = browser.find_element_by_class_name("city")15 input3.send_keys("Smolensk")16 input4 = browser.find_element_by_id("country")17 input4.send_keys("Russia")18 button = browser.find_element_by_css_selector("button.btn")19 button.click()20finally:21 # ÑÑпеваем ÑкопиÑоваÑÑ ÐºÐ¾Ð´ за 30 ÑекÑнд22 time.sleep(30)23 # закÑÑваем бÑаÑÐ·ÐµÑ Ð¿Ð¾Ñле вÑеÑ
манипÑлÑÑий24 browser.quit()...
lesson1_5_step4.py
Source:lesson1_5_step4.py
1import math2from selenium import webdriver3link = "http://suninjuly.github.io/find_link_text"4browser = webdriver.Chrome()5browser.get(link)6find_link_text = str(math.ceil(math.pow(math.pi, math.e)*10000))7print("find_link_text = "+find_link_text)8find_link = browser.find_element_by_link_text(find_link_text)9find_link.click()10input1 = browser.find_element_by_tag_name("input")11input1.send_keys("Ivan")12input2 = browser.find_element_by_name("last_name")13input2.send_keys("Petrov")14input3 = browser.find_element_by_class_name("city")15input3.send_keys("Smolensk")16input4 = browser.find_element_by_id("country")17input4.send_keys("Russia")18button = browser.find_element_by_css_selector("button.btn")...
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!!