Home > Mobile >  Source page instend of the html page like in F12
Source page instend of the html page like in F12

Time:01-26

I trying to extract data AND IPs from VirusTatol.com with selenium and BF in python. On my get request, I get the view-source HTML instead of the HTML with all data like in Inspect mode(F12).

Some Ideas on how I can extract the HTML page like in Inspect mode?

Thank you

CodePudding user response:

You can try

body_html_content = driver.find_element_by_xpath('//body').text 

You can replace "//body" path with whatever tag you want to extract the text from.

If you want to go more specific for an unique element having an unique id, without parsing the whole body, for example:

<span id="my-ip">127.0.0.1</span>

I would go for something like this to get that ip, without the need to use BS:

ip_address = driver.find_element_by_xpath('//span[contains(@id, "my-ip")]').text
  •  Tags:  
  • Related