File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ def test_local (selenium ):
4+ selenium .get ('http://bs-local.com:45454' )
5+ local_page_title = selenium .title
6+ assert local_page_title == 'BrowserStack Local'
Original file line number Diff line number Diff line change 1+ import pytest
2+ from selenium .webdriver .common .by import By
3+
4+ def test_example (selenium ):
5+ selenium .get ('https://bstackdemo.com/' )
6+
7+ # locating product on webpage and getting name of the product
8+ productText = selenium .find_element (By .XPATH , '//*[@id="1"]/p' ).text
9+
10+ # clicking the 'Add to cart' button
11+ selenium .find_element (By .XPATH , '//*[@id="1"]/div[4]' ).click ()
12+
13+ # waiting until the Cart pane has been displayed on the webpage
14+ selenium .find_element (By .CLASS_NAME , 'float-cart__content' )
15+
16+ # locating product in cart and getting name of the product in cart
17+ productCartText = selenium .find_element (By .XPATH , '//*[@id="__next"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]' ).text
18+
19+ # checking whether product has been added to cart by comparing product name
20+ assert productCartText == productText
You can’t perform that action at this time.
0 commit comments