我对XPath并不感兴趣,我需要实现以下目标:
假设我得到了html标签id,并且我需要接收具有给定id的html元素的除id之外的所有属性,例如:
作为输入,我得到了id="test",
作为输出,我需要获得如下内容:
"Key" = "some-randmom-attribute"=
"Value"="value-of-random-attribute";
"Key" = "some-randmom-attribute2"=
"Value"="value-of-random-attribute2";
我需要的是:
该查询将允许获得具有给定id的html标签的所有属性,
干杯
发布于 2018-06-01 07:21:55
假设您正在使用带有Selenium Xpath选择器的Java:
WebElement target = driver.findElement(By.xpath("//*[@id='someID']"));
然后遵循这里创建的解决方案:
Selenium webdriver get all the data attributes of an element
https://stackoverflow.com/questions/50633756
复制相似问题