Questions tagged [python-webbrowser]

Python module that allows the user to load web content with available browsers.

The webbrowser module provides a high-level interface to allow displaying web-based documents to users. Under most circumstances, simply calling the open() function from this module will do the right thing.

More info: https://docs.python.org/3/library/webbrowser.html

406 questions
1
vote
1 answer

Python script not executed from crontab

I am not able to execute the below attached python script via crontab. When I run script directly from CLI it works just fine, I see just a quick action how browser is opened, everything is setup and then browser closes. But when run in crontab,…
Palino1611
  • 39
  • 2
1
vote
1 answer

send a whatsapp message to multiple users automatically using webbrowser (and not using selenium)

I am a beginner in this. I want to send a WhatsApp message to multiple users using web browser module (and not selenium). I have written the following code: import webbrowser msg = input('Enter a Message: ') number = input('Enter contact number:…
Harsh Dhamecha
  • 116
  • 3
  • 12
1
vote
0 answers

How can I write a unit test for python3's webbrowser module?

I want to unit test a bunch of code that looks like this: # First command. This will open reddit in your browser. # ------------------------------------------------------------- if 'open reddit' in command: url =…
Micheal Bee
  • 550
  • 5
  • 11
1
vote
2 answers

in my python 3 i cannot use urllib.request as it says i don't have this submodule so how can i access websites data?

I use python3 and urllib module has parse, error, robotparse only it does not commands like import urllib.request and urllib.request.urlopen so what the substitute or how to fix it
1
vote
0 answers

generate and open HTML string with webbrowser without accessing disc

I want to create a HTML file in my code and open a new tab in chrome with it. this is the code I have. It works: with open('mysite.html','w') as f: f.write('') f.write('') f.write('Table of contents') …
JFerro
  • 3,203
  • 7
  • 35
  • 88
1
vote
2 answers

Is there a way to get the default browser in Python?

I want a way to find the default browser in Python. I've seen https://docs.python.org/3.8/library/webbrowser.html and there might be a way of converting a webbrowser instance which I do not know. Does anybody know how I could go about doing…
Professor Dragon
  • 217
  • 1
  • 4
  • 14
1
vote
0 answers

Login into a php-website and webscrape website using python without selenium

I am trying to login to this website https://www.icloudemserp.com/tpct/ for scraping some data but I am unable to login. I was trying it with requests in python, using get to get the URL and post to send the post URL and the form data. It just…
1
vote
0 answers

i am tring to do web scraping with python and i get these errors again and again

This is my code import bs4 import requests res = requests.get('https://www.anywebsite.com/home') soup = bs4.BeautifulSoup(res.text, 'json') table_body=soup.find('tbody') rows = table_body.find_all('tr') for row in rows: …
1
vote
3 answers

Trouble with searchpyi.py - 'Automate the Boring Stuff with Python'

I am having a little trouble trying to get this performed for output after searching. It did not happen anything such as opening web browsers. Am I doing something wrong? Your tips and advice would be so much appreciated. Here's the code I entered…
Makobak232
  • 21
  • 3
1
vote
0 answers

How can i transfer my python program on a website

I got a program, written in python, and my mission is to implement this on a website, so other can have access to it. I already tried Django and Flask, but they want me to translate my python code into html. I'm searching for the possibility to…
1
vote
4 answers

Play YouTube video using webbrowser in python3

I want to play YouTube video using Python3. I can open the YouTube video using webbrowser.open(), but then i need to either press space or mouse click the play button to actually play the video. How to automate this, without using seleinum if…
1
vote
1 answer

Python using webbroswer.open() to download a file

I understand how to call chrome with webbrowser to access a url, however, if that url led to a download, how would I automatically save the file to an assigned destination? Here's what I have: import webbrowser import os url =…
Awais Shah
  • 17
  • 1
  • 6
1
vote
3 answers

Open webbrowser in background

How can I open a URL with my default webbrowser in the background without changing window focus? In other words I want to stay in the terminal while opening the webbrowser. I have tried the webbrowser module without success. Python 3.8.1 (default,…
Rickard Körkkö
  • 548
  • 3
  • 10
1
vote
2 answers

Open tabs using Python script

I'm learning Python and I'm trying to create my own script to automate stuff at work. I'm trying to open a web browser (no matter which one) with a default url and 2 or more tabs with different urls. I tried open_new(), open(), open_new_tab() but…
1
vote
1 answer

Is there a way to force webbrowser into opening a new window instead of just opening tabs in current windows?

import webbrowser import os n = "" while (n == ""): n = input("How many pages do you want?\n") start_page = "" url = input("Yeezy Supply or Adidas?""\nEither 'YS' or 'Adidas'\n") url_choice = url.lower() #print(url_choice) if url_choice == 'ys': …
user10593699