0

On my raspberry pi, I have my HTML/CSS/JavaScript page up and running in a web browser. I have python interacting with the GPIO pins on my raspberry pi. After a certain event happens involving the GPIO pins, I want the python script to change the page in the web browser. I have already tried:

webbrowser.open('websitehere.com', new = 0)

Unfourtunately, that did not work for me and just opened a new window. I could just open another tab and close the previous tab but I really do not want to do that. I was wondering if there was a way to have the python script tell my javascript what happened and have my JavaScript change to one of the other html files that I have. Thanks.

Edit: and no. it is not missing the http or anyting. I even tried it like this(since I have the html files on my computer) and it still does not work:

import time
import webbrowser
webbrowser.open('C:\Users\iJason\Documents\Smart_Calendar\Smart_HTML\Calendar.html')
time.sleep(3)
webbrowser.open('C:\Users\iJason\Documents\Smart_Calendar\Smart_HTML\Ads.html', new = 0)

Let me know if there is another problem. If not, I am going to start using the solution of using Selenium. thanks!

Edit 2: Ok, so this is a common problem: Am I using the webbrowser.open() wrong, or does it not work as advertised? (Python)

It has to do with the way the browser is configured. But I am not sure how to change the way the browser is configured so that doing this command will work.

2
  • 1
    Try selenium with the chrome/firefox driver. Commented Nov 12, 2016 at 19:34
  • Could it be that you need to prepend "h t t p : / / " or "w w w" or something akin? Commented Nov 12, 2016 at 19:51

1 Answer 1

1

As Ukimiku stated, please try:

webbrowser.open('http://websitehere.com', new = 0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.