File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once ('vendor/autoload.php ' );
3+
4+ use Facebook \WebDriver \WebDriverBy ;
5+
6+ class Test extends BrowserStackTest {
7+
8+ public function testBrowserstackDemo () {
9+ self ::$ driver ->get ("https://bstackdemo.com " );
10+ // store item to add to cart
11+ $ item_to_add = self ::$ driver ->findElement (WebDriverBy::xpath ("//*[@id='1']/p " ))->getDomProperty ('innerText ' );
12+ // click on add to cart button
13+ self ::$ driver ->findElement (WebDriverBy::xpath ("//*[@id='1']/div[4] " ))->click ();
14+ // get the item from cart
15+ $ item_in_cart = self ::$ driver ->findElement (WebDriverBy::xpath ("//*[@id='__next']/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1] " ))->getDomProperty ('innerText ' );
16+ // assert item in cart is same as one that was added
17+ $ this ->assertEquals ($ item_to_add , $ item_in_cart );
18+ }
19+ }
20+ ?>
You can’t perform that action at this time.
0 commit comments