Cautionary note: I don’t work with XPath. I work with CSS. Even so, looking at your XPath it looks quite fragile. Long XPath locators and long CSS selectors are inherently fragile - one seemingly minor change to the page and your selector are prone to breakage. That said…
This CSS selector will target the svg element itself:
The zip file you attached contained HTML.txt file which contains <svg> element only without wrapping <html> structure. When I open the HTML.txt file, browser shows the source but can not render the image. Therefore it is impossible for me to reproduce your problem.
Is your Application Under Test publicly accessible? If so, please share the URL.
Your new zip does not contain <html>...</html> markups; it only contains SVG markups. It is not enough. Because the SVG markup detail is not in question. Rather whole HTML markup structure is in question.
Please make a full HTML file which contains your SVG markup so that others can reproduce your problem on their side. For example, on having the page is rendered in your Chrome browser, you can do right-click the page > Save as … to get the full HTML source.
Unless you provide it, sorry I am not able to look into your problem.
i am unable to click on the box with the xpath values that i have mentioned. The Spy Web also does not capture the xpath values for the ‘Select Box’. What am i doing wrong here?
It is a bad idea to rely on the Spy Web tool. Don’t expect it to provide you a complete solution. Especially when the HTML of your Application Under Test is complexed, simply the tool fails to be useful.
And you should study XPath technology and/or CSS Selector technology first. Once you got enough understanding about the XPath/CSS, then the Spy Web tool can be a nice help for you. Without the background knowledge, a GUI tool would be just a puzzle.
Seriously, what is your problem. You have been given TWO solutions. One by me in CSS and one by @kazurayam in XPath. Apart from syntactic changes, they are identical.
Pick one. Get it working (with apologies to John Cleese) “before one of us dies”.
@saumil.sah a bit of added info here:
spy tool will just ‘guestimate’ and propose some selectors to you, based on internal implemented algorithms (which may change in time) and what can capture on the rendered page (which sometime can be browser dependant)
You don’te have to trust them blindly, it is just a quick helper.
study the proposed topics (css vs xpath) and a bit of html basics to understand how to use the selectors properly.
Until now i used to blindly trust the Spy tool! this was an eye opener. Will keep it in mind You are right! i need to update myself with the right way of writing xpath and i guess it’s about time that CSS should be in my learning plans