+ 22
Python and Webbrowser
How can I access the internet with Python? Unfortunately, “import webbrowser”... webbrowser.open ("https://news.google.com/?pt1=true#0") or “open.Webbrowser ...” does not work. Does somebody has any idea? Thank you.
22 Respuestas
+ 12
Thank you for your answer. I tried it with selenium. An error message did not come! Presumably, the system still needs to know which browser.?! Thanks first for your quick reply. 👍👍👍 I will look again.😉
+ 12
But one question is completely unclear to me. If I enter "Python WebBrowser Most Recent" then I get 6 programs from the last 2 years, all of which look similar: "import webbrowser
a = webbrowser.open ( "www.google.com")
print (a)
But not a single code works.
It must have worked at least once, at the time of publication. Why does not this work anymore?
+ 12
Thank you. Very helpful your answer.
+ 12
yes Shane Umayanga you are right. 😉
Instead of answers, I only get stupid questions. Only Jason Edelson was very helpful. Thanks again. Luckily I'm very close to the solution.👍
+ 11
Jason Edelson
Many thanks for your effort. I will try it (probably not today). THANK YOU👍👍👍😉
+ 11
Okay. Thank you. What do you mean with Idle?
+ 11
And all the other coders who published the programs knew about the problem?
+ 11
Thanks a lot for your efforts. Then Python most likely is out of the question for me.
EDIT: (if I can not find another solution)
+ 10
Jehan Khan
(for your Answerer Badge)
+ 9
I don‘t know. Please tell me.
+ 8
Apple Blossom Many thanks for your response. I guess we speak from Linux. I have Linux on my laptop for years and then I would know to help me too. Now that wanted to do it with my mobile phone. And I also found a way. Will this work out in the near future. But I'm very grateful for your solution. Thanks a lot. 👍👍👍😉
+ 7
import requests if you want to work with html. if you want to actually open a browser import selenium
+ 6
Why do people think Google = The Internet?
+ 5
If anyone is still trying to figure it out and needs an example here
make sure your driver is in the same location as your .py code
https://code.sololearn.com/cBTUjTaGSlqr/#py
+ 4
Idle is the default editor/shell that comes with python when downloaded.
Possible issues are fixed as long as path to browser is provided
+ 4
Kebap that's programming 😂
+ 3
Tried that exact code in Idle and it worked.
Opened google and outputted true.
I believe if you have no default browser set you will encounter an error, trying on linux may also have issues.
+ 3
I would recommend You to use ,,grab" lib
+ 2
ydkfuthhgwnsigdtly2yhyswu5rbv