How to use test_find_by_css method in websmith

Best Python code snippet using websmith_python

test_find_element.py

Source:test_find_element.py Github

copy

Full Screen

...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,...

Full Screen

Full Screen

test_finders.py

Source:test_finders.py Github

copy

Full Screen

...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):...

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 websmith 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