-1
I’m having a problem creating a list
with attributes follows HTML code:
<div class="post clearfix" data-post-id="92842173">...</div>
<div class="post clearfix" data-post-id="92841636">...</div>
<div class="post clearfix" data-post-id="92618462">...</div>
<div class="post clearfix" data-post-id="90658834">...</div>
current c# code:
var valor = chromeDriver.FindElement(By.XPath("//div[contains(@class, 'post')]")).GetAttribute("data-post-id");
so just get the first one data-post-id="92842173"
.
I would like to create a list of all data-post-id
. I have tried to do as follows below, but it is a mistake.
List <IWebElement> list1 = chromeDriver.FindElement(By.XPath("//div[contains(@class, 'post')]")).GetAttribute("data-post-id");
chromeDriver does not have a Findelements method?
– Bruno Piovan
yes, it has, I use to locate the div where it contains the attribute I need to extract, but I can’t extract all or 1 by 1, I can only extract the 1° attribute, I need a function to extract all the post-id data.
– William Kidd
See if you have something like Findallelement or selectElement on your chromeDriver
– Marco Souza