File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
XPath-locators-advanced/src Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ package src ;
2
+
3
+ import org .openqa .selenium .By ;
4
+ import org .openqa .selenium .WebDriver ;
5
+ import org .openqa .selenium .WebElement ;
6
+ import org .openqa .selenium .chrome .ChromeDriver ;
7
+
8
+ import java .util .concurrent .TimeUnit ;
9
+
10
+ public class XPathSiblingNodes {
11
+
12
+ public static void main (String [] args ) {
13
+
14
+ WebDriver driver = new ChromeDriver ();
15
+ String baseURL = "https://learn.letskodeit.com/p/practice" ;
16
+ driver .manage ().window ().maximize ();
17
+ driver .manage ().timeouts ().implicitlyWait (10 , TimeUnit .SECONDS );
18
+ driver .get (baseURL );
19
+
20
+ WebElement price = driver .findElement (By .xpath ("//td[text()='Python Programming Language']//following-sibling::td" ));
21
+ // printing price of the book "Python Programming Language" to the console
22
+ System .out .println (price .getText ());
23
+
24
+
25
+ }
26
+
27
+ }
You can’t perform that action at this time.
0 commit comments