-1

I need to capture all the html code within a frame in a webpage, all the data seems to be within a class as follow:

<div class="productos-mant">

Within this class you can find all the items like

<a class="round-item" href="https://www.supermercado.com/my-basket/profile" data-id ...etc</a>

Is any method that allow me to catpure to a .txt all the html info from this class in the frame?

thanks!

undetected Selenium
  • 151,581
  • 34
  • 225
  • 281
FC_J
  • 53
  • 1
  • 6
  • See: [How do I do X?](https://meta.stackoverflow.com/questions/253069/whats-the-appropriate-new-current-close-reason-for-how-do-i-do-x) The expectation on SO is that the user asking a question not only does research to answer their own question but also shares that research, code attempts, and results. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! See also: [ask] – JeffC Jan 24 '18 at 16:10

1 Answers1

0

You asked for all the html code within a frame in a webpage. First, call the switchTo() method using frame name or id, e.g.

driver.switchTo().frame("frame_name");
driver.switchTo().frame("frame_id");

You can find a detailed discussion here. Once you are within the intended frame, you can grab the entire HTML using getPageSource().

System.out.println(driver.getPageSource());
JeffC
  • 19,228
  • 5
  • 29
  • 49
undetected Selenium
  • 151,581
  • 34
  • 225
  • 281
  • there isn´t a frame name or id, the html data is inside the class, the only way to capture is with copy outerhtml option, is there any method to get it? – FC_J Jan 30 '18 at 14:51
  • @FC_Javier Yes, there are ways to do that even. Can you please raise a new Question with your new requirement please? We will be happy to help you out. – undetected Selenium Jan 30 '18 at 15:43