selenium как из тегов достать значение
как отсюда достать значение с помощью selenium?
public static void main(String[] args) throws InterruptedException {
//WebElement e = driver.findElement(By.id("click"));
//System.out.println(e.getAttribute("href"));
System.setProperty("webdriver.chrome.driver", "C:\\Users\\giosan777\\Desktop\\selenium-2.40.0\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.lider-bet.com/web/ka/playVolt");
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
driver.switchTo().frame("frame");
//WebElement element = driver.findElement(By.className("hash-table"));
//System.out.println(element.getAttribute("hash-table"));
List<WebElement> TRCollection = driver.findElement(By.className("hash-table"))
.findElements(By.tagName("tbody"));
for (WebElement tr : TRCollection)
{
List<WebElement> TDCollection = tr.findElements(By.tagName("td"));
for (WebElement td: TDCollection)
{
System.out.println(td.getText());
}
}
driver.quit(); //close Chrome
}
Ответы (1 шт):
Автор решения: Sergei Rudik
→ Ссылка
Например, вот так:
String elementval = driver.findElement(By.id("input_name")).getAttribute("value");
Только подставьте свой селектор.
