I did try some of xpaths but seems no luck.
I want to click on country and then graph , Given below screenshot :
Website URL is : https://demos.telerik.com/kendo-ui/bar-charts/column
I tried xpaths :
//text(text()='India')
//g//text(text()='India')
Hi you can click India with the following Xpath
//*[text()='India']
This is a really helpful resource
I usually open chrome inspector and then hit cntrl+F to open up an interactive way to test my xpaths:
You can target the svgs by using their strokes, but note these may change often. example:
//*[@d='M54.5 164.5 L 70.5 164.5 70.5 236.5 54.5 236.5Z' and @stroke='#03a9f4']
The elements on chart are from SVG-namespace, so you cannot use common syntax to select those elements (you wouldn't be able to select element by its tag name, e.g.
//svg
or//path
, etc)You can try below to select
text
node with text"India"
:As the desired elements are SVG Elements you need to consider the namespace and induce WebDriverWait for the desired element to be clickable and to click on the first bar within the graph you can use the following solution:
Code Block:
Browser Snapshot: