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
2
votes
1 answer

Python webbrowser module sometimes fails to open url in Chrome

I have Chrome configured as my default browser, on Mountain Lion. At the end of my Python 2.7.4 program I have the following: import webbrowser webbrowser.open('http://example.com') Sometimes instead of opening the tab as the documentation suggests…
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
1
vote
2 answers

Python webbrowser outputting page to console on Windows

I'm writing a PyGTK application on Windows, and in a function, I'm trying to open a webpage with the webbrowser module. It should be the simplest thing in the world, but instead of opening in a browser, it prints the HTML source of the page to the…
soren121
  • 368
  • 3
  • 16
1
vote
0 answers

Problem with inserting a string into the python webbrowser

I am trying to write a progam that is supposed to open random links in my browser, using the webbrowser module and the random module. I am also using a .txt file where all the links are saved. I have the browser defined as: firefox =…
ojilhkugz
  • 11
  • 2
1
vote
0 answers

Can't open web browser with webbrowser module

I'm trying to open an url using python webbrowser module. When the code below runs nothing happens. import webbrowser webbrowser.open_new('http://www.python.org') But when a sleep time is given, the browser opens and closes after the sleep time is…
Shyam3089
  • 459
  • 1
  • 5
  • 20
1
vote
0 answers

How to use speech recognition module in python and use it in another program

I have made a web browser by using python and I need to use speech recognition to control it (eg: open a tab, Close a tab, type Url) import speech_recognition as sr listener = sr.Recognizer() class VoiceRecognition(): def…
1
vote
1 answer

Opening URL in new tab without focus

I monitor a bunch of field logger devices at my job that are connected to water mains. There is no way to open the graphs for all loggers at once. So, rather than manually opening each logger's graph, I've tried to write a program for opening them…
1
vote
1 answer

python selenium checking for element in chrome doesn't work as expected

This works just fine in Firefox. When I use Chrome, once the page fully loads it doesn't print "element loaded", and it doesn't go to timeout either. It just waits forever. I've tried using visibility_of_element_located instead of…
1
vote
1 answer

Error "Parameter 'url' unfilled" using PyQt5 with url set

import sys from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebEngineWidgets import * class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.browser = QWebEngineView …
melone
  • 13
  • 4
1
vote
1 answer

Python - How to search in google without typing url

I tried to take the input from the user, copy it, and then open google and paste the input. this is my code: import webbrowser import pyperclip question = input("search for: ") pyperclip.copy(question) url = 'http://www.google.com/' chrome_path…
Basel
  • 17
  • 1
  • 3
1
vote
1 answer

In MacOS, the webbrowser open function not return

I want to open a web browser tab with this simple python script: import webbrowser print('About to open') webbrowser.open('http://google.fr') print('Opened') When I try it in my MacOS terminal, the tab is correctly opened but the script does not…
1
vote
2 answers

Gmail auto login and error message python

I am trying to login to the blogger site, but first I have to enter the Gmail account. I entered it, but an error message appears, "This browser or app may not be secure" can you help me with this error. this is my code from statistics import…
1
vote
0 answers

webbrowser.get why does the path string contain %?

I have this code: import webbrowser def main(): url = 'https://stackoverflow.com/users/7318120/d-l' path_to_chrome = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe' # fails path_to_chrome = 'C:/Program Files…
D.L
  • 4,339
  • 5
  • 22
  • 45
1
vote
0 answers

Force window to appear in foreground in Python and selenium

I have a script that opens a web page at regular intervals and performs some operations on it. This script is based on the selenium library in Python. When this script is run during a period when the computer is undisturbed and no other scripts are…
lazarea
  • 1,129
  • 14
  • 43
1
vote
1 answer

Killing a chrome process by url name using python

I would like to run a python automation that will kill a particular chrome tab, by its url name. For example: if time is 09:00, and url is "www.youtube.com", kill this process. I didn't manage to do it using psutil, with the following code, since I…
1
vote
0 answers

How do I make Python's speech recognition module take my YouTube search query

I'm working on a voice assistant using Python. I would like to make Python take my search query and automatically type it in the YouTube search bar. I'm able to open YouTube but I'm not able to make Python take my search query. Microsoft keeps…