Is there a way to copy all text on a webpage and paste in a variable in Python 3.62 ?
I am looking for a solution that does not use SendKeys("^a",0)/SendKeys("^c",0)
If you mean just the html of the page then page is the variable that contains the webpage HTML
import urllib.request
f = urllib.request.urlopen(URL)
page = f.read()
import requests
r = requests.read(URL)
page = r.text
Sorry, I may not make clear. I only need all text on webpage, not all html. For example, If I
1. Launch
https://www.google.com
2. Press Ctrl+a -- select All
3. Press Ctrl+c -- copy the selection
4. Press Ctrl+v -- paste to get text as below
but I don't want to use SendKeys
About Store
Gmail
Images
Switch to Chrome
Hide annoying ads and protect against malware on the web
NO THANKSYES
Ho ho ho! Follow Santa's journey around the world with Google Maps
Google offered in: Français
Canada
PrivacyTermsSettings
AdvertisingBusiness