-3

enter image description here

Refresh icon. Can some one help me to locate an element (XPath or CSS) which is displayed?

<svg class="ult-icon .....height: 20px;">

HTML below: link.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 3
    Make your question more clear. – Maxwell s.c Oct 11 '17 at 19:50
  • 2
    Welcome to Stack Overflow. Please review [How do I ask a good question](https://stackoverflow.com/help/how-to-ask). What have you already tried yourself to find the problem? Questions should show evidence of research and attempts to solve the problem yourself, a **clear outline of your specific issue, and any relevant code in a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)**, so we have enough information to be able to help. – FluffyKitten Oct 11 '17 at 19:51
  • https://i.stack.imgur.com/7ICOR.png – Maxim Cheremnykh Oct 11 '17 at 20:00
  • 1
    Please post your code, not a picture of it. – Dave Oct 11 '17 at 20:03
  • Hi, I'm new here, I try to post code, but it doesn't display – Maxim Cheremnykh Oct 11 '17 at 20:40
  • Check [this solution for locating `svg` nodes](https://stackoverflow.com/questions/41829000/selenium-webdriver-java-how-to-click-on-elements-within-an-svg-using-xpath/41829572#41829572) – Andersson Oct 11 '17 at 20:43
  • @MaximCheremnykh When you post HTML, you need to format it as code. Then it will be visible. `SVG` and related tags are just like all other HTML tags. Post your code attempts so we can help figure out why it's not working. – JeffC Oct 11 '17 at 22:12
  • I solved! Thanks everyone – Maxim Cheremnykh Oct 12 '17 at 18:12

1 Answers1

1

The short answer is No, no one here can find the element you need for you. First, we'd need to see the entire page to tell you how to access the element, it may be in an iframe or multiple iframes, etc. Second, that's not really how this works.

What we can do is help you find it yourself. So, here's what I would try.

First, I'd use FireFox's developer version and inspect the element. To do this browse to the page in Firefox, right click on the element in the page and select inspect. This will open a new screen that you can use to see the HTML and JavaScript. From there you can right click on the selected element and copy the XPath, CSSS selector or grab the id from either of those.

Second, you need to determine if you are in an iframe. Once you are in the inspection screen, there is a path bar that can scroll left and right at the bottom of the screen. Check that to confirm that and look for iframe tags to determine if your element is inside of an iframe. If it is, you will need to switch to the correct frame before accessing the element. You may have to switch into multiple iframes, like moving through a directory structure, before you get to the correct one. Once you are there you should be able to access and work with the element.

Third, depending on the element you may find that some Find By methods work better than others. Try the Find By Xpath, CSS Selector, Link Text or Id until you get one that works. This is just trial and error. I usually start with the Xpath.

halfer
  • 19,824
  • 17
  • 99
  • 186
Haendler
  • 313
  • 1
  • 2
  • 10