S
S
stas09092021-07-26 14:13:50
Java
stas0909, 2021-07-26 14:13:50

How to convert a page into Document (Java) format using selenium webdriver?

i have code
System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
String baseUrl = " https://google.com ";
driver.get(baseUrl);
String str = driver.getPageSource();
System.out.println(var);
System.exit(0);
driver.close();

how can i make str be a Document? or element?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hung1337, 2021-07-26
@Hung1337

What for to you to do from str Document?
Why not just do this: WebElement element = driver.findElement(By.className("class"));
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question