0% found this document useful (0 votes)
55 views4 pages

Broken Links

The document discusses XPath and provides examples of absolute and relative XPath. Relative XPath is preferred because absolute XPath will not work if there are any changes to the web page. It also provides examples of how to write XPath using attributes and tags, and how to generate XPath using developer tools or browser extensions. The document then provides a sample test case and assignment to practice XPath.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views4 pages

Broken Links

The document discusses XPath and provides examples of absolute and relative XPath. Relative XPath is preferred because absolute XPath will not work if there are any changes to the web page. It also provides examples of how to write XPath using attributes and tags, and how to generate XPath using developer tools or browser extensions. The document then provides a sample test case and assignment to practice XPath.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

D Day-20

-------

XPath

--------

Address of an element

DOM - Document Object Model

2 kinds of xpaths

------

1) Absolute xpath( full xpath)

/html/body/header/div/div/div[1]/div/a/img

2) Relative xpath ( partial xpath)

//div[@id="logo"]/a/img

//img[@title='Your Store']

differences....

which one you will prefer?

Relative xpath

why?

bcoz absolute xpath wont work if there are any changes in web page.

How to write our own xpath?


//*[@attribute='value']

//tagname[@attribute='value']

How to generate xpath automatically?

1) using developer tools

2) using selectors hub - extension of browser

//img[@title='Your Store']

xpath having multiple attributes

xpath functions - text(), normalized-pace(), contains() start-with()

xpath operators - and or

xpath axes - following, preceding, sibling, parent, self, ancestor etc.....

How to locate elements who attributes are dynamically changing

ay-17

------
Test case

--------

1) Launch browser

2) open url

https://opensource-demo.orangehrmlive.com/

3) Provide username - Admin

4) Provide password - admin123

5) Click on Login button

6) Verify the title of dashboard page

Exp title : OrangeHRM

7) close browser

Assignement

----------------

1) Launch browser

2) open url

URL: https://admin-demo.nopcommerce.com/login?ReturnUrl=%2Fadmin%2F

3) Provide username - [email protected]

4) Provide password - admin

5) Click on Login button

6) Verify the title of dashboard page

Exp title : Dashboard / nopCommerce administration

7) Verify Dasboad

ref

----

WebElement txtemailbox=driver.findElement(By.name("username"));

txtemailbox.clear();

txtemailbox.sendKeys("email..");
driver.findElement(By.id("Email"));

You might also like