I want to open an xml webpage and after opening the webpage,
I want to save the xml content displayed in the webpage as file1.xml
file.
What I tried:
from selenium import webdriver import os from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys chromedriver = "/home/dipankar/Desktop/chromedriver" os.environ["webdriver.chrome.driver"] = chromedriver driver = webdriver.Chrome(chromedriver) #driver = webdriver.Firefox() driver.get("http://www.example.com") saveas = ActionChains(driver).key_down(Keys.CONTROL).send_keys('S').key_up(Keys.CONTROL) saveas.perform()
I tried the following code, but it downloads the html
tags also. I want to download only the content displayed in the web page. Not the page source.
content = driver.page_source print content
Here I attached screen shot of the sample webpage.
wget
is available in python. Thanks.driver.page_source
code gives correct xml webpage content in firefox. but this same code gives html tags in chrome.