Selenium using XPath to locate the entire article
One of the articles mentions XPath element positioning, but some of the articles do not fit into special and personalized scenarios. You can find the solution you need here in the text that provides the ultimate placement of XPath elements.
The first approach: positioning with absolute paths (I'm sure you won't use this way)
By.xpath ("Html/body/div/form/input")
By.xpath ("//input")
Third method: Positioning by Element Index
By.xpath ("//input[4]")
Fourth method: Use the XPath attribute to locate (combined with the 2nd, 3rd method can be used)
By.xpath ("//input[@id = ' kw1 ']")
By.xpath ("//input[@name = ' kw1 ']")
Fifth method: Use partial attribute value matching (the most powerful method)
By.xpath ("//input[start-with (@id,' nice ')
By.xpath ("//input[ends-with (@id, ' very pretty")
By.xpath ("//input[contains (@id, ' so Beautiful ')]")
6th method: Using the XPath axis (not used)
Hopefully, these methods will help you.
XPath positioning Daquan