Best Python code snippet using websmith_python
test_find_element.py
Source:test_find_element.py
...31 browser.find_element_by_link_text("Login").click()32 browser.find_element_by_id("input-email").send_keys("d12d17d17@gmail.com")33 browser.find_element_by_id("input-password").send_keys("admin", Keys.ENTER)34 time.sleep(5)35def test_find_by_css(browser): # https://habr.com/ru/company/otus/blog/350368/ - напиÑание css ÑелекÑоÑов36 '''37 button[type=âsubmitâ].button_submit #38 Ñег аÑÑибÑÑ ÐºÐ»Ð°ÑÑ id39 '''40 browser.find_element_by_css_selector('.product-layout img[title="iPhone"]').click()41 browser.find_element_by_css_selector(".btn#button-cart").click()42 time.sleep(2)43 browser.find_element_by_css_selector("#cart-total").click()44 browser.find_element_by_css_selector(".text-right a strong").click()45 time.sleep(2)46 assert browser.title == 'Shopping Cart'47# a[href^=âhttps:â] â Ð½Ð°Ð¹Ð´ÐµÑ Ð²Ñе ÑÑÑлки, коÑоÑÑе наÑинаÑÑÑÑ Ñ https,...
test_finders.py
Source:test_finders.py
...9 FindByXPATH,10 Go,11)12from websmith.ui import Session13def test_find_by_css(browser, page):14 '''Find web elements by its css attribute.'''15 with Session(browser):16 Go(page)17 elements = FindByCSS('li')18 for element in elements:19 assert element.tag_name == 'li'20def test_find_by_id(browser, page):21 '''Find web elements by its id.'''22 with Session(browser):23 Go(page)24 assert FindByID('login').tag_name == 'form'25def test_find_by_name(browser, page):26 '''Find web elements by its name.'''27 with Session(browser):...
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!!