1

I'm not really epxerienced witn XPath and I need to achieve the following:

Let's assume I'm given html tag id and I need to receive every attribute, except for id, for the html element with a given id e.g.:

As an input I'm given id="test",

As an ouput I need to get something like:

"Key" = "some-randmom-attribute"= 
"Value"="value-of-random-attribute";

"Key" = "some-randmom-attribute2"= 
"Value"="value-of-random-attribute2";

What I need is:

The query that would allow to get all attribute of html tag with given id,

Cheers

Andrey Yaskulsky
  • 2,458
  • 9
  • 39
  • 81
  • Possible duplicate of https://stackoverflow.com/questions/2048720/get-all-attributes-from-a-html-element-with-javascript-jquery – Mesar ali May 31 '18 at 22:48

1 Answers1

1

Assuming you're using Java with a Selenium Xpath selector:

WebElement target = driver.findElement(By.xpath("//*[@id='someID']"));

And then follow the solution created here:

Selenium webdriver get all the data attributes of an element