-1
私はcode..Iは私が取ることができるかわからないこのHTML内のすべてのデータ・ソースのURLを取りたい
このcode..Canの誰も私がセレンは、データ・ソースのURL
<ul class="resp-tabs-list">
<li class="resp-tab-item resp-tab-active" aria-controls="tab_item-0" role="tab">
<a class="js-tab-list js-tab-1" data-source="https://www.adsdssas.com/property/individual/BC-2030877?isl=1" data-no="1" data-ga="0" target="iframe_1">
<img src="/themes/centralization/images/partners-tab-logo/rentalhomes-tab-logo.png" alt="RentalHomes.com" height="20" width="auto">
</a>
</li>
<li class="resp-tab-item" aria-controls="tab_item-1" role="tab">
<a class="js-tab-list js-tab-1" data-source="https://www.jdoasdadadqocy.com/click-8111003-11553823?url=https%3A%2F%2Fwww.vrasbo.com%2Fvacation-rentals%3Fq%3DDauphin%2BIsland%252C%2BAL%252C%2BUSA&utm_campaign=RENTALHOMES&sid=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&label=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&ft=1" data-no="1" data-ga="0" target="iframe_1">
<img src="/themes/centralization/images/partners-tab-logo/feed_logo_vrbo.png" alt="VRBO.Com" height="20" width="auto">
</a>
</li>
<li class="resp-tab-item" aria-controls="tab_item-2" role="tab">
<a class="js-tab-list js-tab-1" data-source="https://www.jdadsdoqocy.com/click-8111003-10859031?url=https%3A%2F%2Fwww.homeaway.com%2Fresults%2Fkeywords%3ADauphin%2BIsland%252C%2BAL%252C%2BUSA&utm_campaign=RENTALHOMES&sid=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&label=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&ft=1" data-no="1" data-ga="0" target="iframe_1">
<img src="/themes/centralization/images/partners-tab-logo/feed_logo_12.png" alt="HomeAway.Com" height="20" width="auto">
</a>
</li>
<li class="resp-tab-item" aria-controls="tab_item-3" role="tab">
<a class="js-tab-list js-tab-1" data-source="https://www.dddoaoa.com/click-8111003-11327743?url=https://www.asdasd.com/search.do?q-destination=Dauphin+Island%2C+AL%2C+USA&utm_campaign=RENTALHOMES&sid=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&label=MTUwMTE0MTI4NDIwMi41LjUwLjQzLTM&ft=1" data-no="1" data-ga="0" target="iframe_1">
<img src="/themes/centralization/images/partners-tab-logo/feed_logo_14.png" alt="Hotel.Com" height="20" width="auto">
</a>
</li>
これを試してみました助けを得ますコードとすべてが今よく見える
for (String windows : wd.getWindowHandles()) {
wd.switchTo().window(windows);
if (wd.getCurrentUrl().startsWith("http://something.com")) {
List<WebElement> url = wd.findElements(By.xpath("//li/a"));
for(WebElement now : url)
{
System.out.println(now.getAttribute("data-source"));
}
}
}
自分で書くことを試みたコードはありますか? –
はい私は1つのコードを書いていますが、それは私のオフィスですpc.Sorry明日私はそのコードを追加します..ありがとう – zsbappa
[webdriver内のdiv内の属性値を取得する方法](https://stackoverflow.com/questions)/17592786/how-to-get-attribute-value-inside-a-div-in-webdriver) – JeffC