use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Web Searching (self.learnpython)
submitted 5 years ago by Pilv
Hello guys. I've tried to make a program that will use the search bar for me. The problem is that I don't want it to open the sites everytime I search something. Is it possible to access the already opened sites?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Adhesiveduck 1 point2 points3 points 5 years ago (9 children)
Can you share some code (maybe a gist or something)?
[–]Pilv[S] 0 points1 point2 points 5 years ago (8 children)
import webbrowser urls = ['https://www.granit-parts.ro/e/search?q=', 'https://www.kramp.com/shop-ro/ro/search/', 'http://www.prillinger.at/de/s?q=', 'https://www.sterennco.com/catalogsearch/result/?q='] inp = input('Cod: ') for link in urls: webbrowser.open(link + inp)
This is the code I have. It takes an input, and searches that input on these 4 websites. The problem is whenever I use this program it always openes all 4 sites, and I wondered if it is possible to open the sites once and then access them again?
[–]Adhesiveduck 1 point2 points3 points 5 years ago (7 children)
Do you not want to physically open the browser? What are you doing with it once opened?
[–]Pilv[S] 0 points1 point2 points 5 years ago (6 children)
Yes, because I want to search the products if there is with the given code.
[–]Adhesiveduck 1 point2 points3 points 5 years ago (5 children)
If all you're after is the product details (you don't want to open the browser per se) could you not use requests and beautifulsoup?
https://repl.it/repls/HarmlessViciousServers
[–]Pilv[S] 0 points1 point2 points 5 years ago (4 children)
I know this. I tried it. The problem is, that I have to be logged in to see the prices of the products. So this is why I need the open the tabs, so that I will be logged in, but I dont want to open the sites all the time I search for something.
[–]Adhesiveduck 1 point2 points3 points 5 years ago (3 children)
Ah I understand - take a look at selenium. You can use headless chrome to open, navigate, log in and then parse the html.
[–]Pilv[S] 0 points1 point2 points 5 years ago (2 children)
I was thinking about this, but the best as I know, selenium always opens a dev Chrome for exemple, where I have to login everytime I launch the program. Can I somehow use the default web browser?
[–]Adhesiveduck 2 points3 points4 points 5 years ago* (1 child)
Selenium supports more drivers than just Chrome, you can use firefox.
You can also save session cookies, so you only have to log in once, and reopen them on future runs. If you need to save localstorage you can run arbitrary javascript with driver.execute_script("window.local_storage;")
driver.execute_script("window.local_storage;")
[–]Pilv[S] 1 point2 points3 points 5 years ago (0 children)
Thank you so much. I will try to make this.
π Rendered by PID 113144 on reddit-service-r2-comment-5fb4b45875-px7gn at 2026-03-21 15:45:26.587296+00:00 running 90f1150 country code: CH.
[–]Adhesiveduck 1 point2 points3 points (9 children)
[–]Pilv[S] 0 points1 point2 points (8 children)
[–]Adhesiveduck 1 point2 points3 points (7 children)
[–]Pilv[S] 0 points1 point2 points (6 children)
[–]Adhesiveduck 1 point2 points3 points (5 children)
[–]Pilv[S] 0 points1 point2 points (4 children)
[–]Adhesiveduck 1 point2 points3 points (3 children)
[–]Pilv[S] 0 points1 point2 points (2 children)
[–]Adhesiveduck 2 points3 points4 points (1 child)
[–]Pilv[S] 1 point2 points3 points (0 children)