How would I error check if there is a previous page for the chromium browser to go to? I have a button which freezes out if the chromium instance has just been launched and there is not a previous page to go to using the command page.goback()
This is a bug and is not intended behavior. You should consider reporting it as an issue on the GitHub repo.
Related
I am trying to create a python application while using eel to create a user interface in html. My operating system is Ubuntu Linux and I'm using Firefox to display the web interface.
The problem I'm having is every time I run the python code, Firefox opens a blank page saying "Unable to connect" followed by "Firefox can't establish a connection to the server at localhost:8000". However, if I click the "Try Again" button once, twice, or three times, my interface is displayed.
Once open, I can navigate to different pages but I also noticed that once I navigate to a different page, some of my javascript stops working (specifically a window.close() function). I don't know if this is related but I thought I would mention it just in case.
Any advice on the matter would be greatly appreciated.
Thank you.
I changed my browser from firefox to chromium and now my interface loads on startup the first time. I know some documentation says it can be used with firefox, and it can, but it seems to be kind of buggy and works better with other browsers.
However, I'm still having trouble with my javascript not running but that will be another question.
I am using the Heroku Chrome buildpack and am wondering what version it is running. I am trying to use it with a webpage but the webpage tells me I can't use it because the site needs chrome version 60 or above.
However the chromedriver used with it is version 103 something.
Is there some update that needs to happen or is the code not going to work?
To start with you need to manually spin-off the google-chrome browser and accessing chrome://settings/help you need to check the browser version as follows and update the browser version if required:
Once your program successfully initiates the Google Chrome browsing context you can extract the browser version on the run, programatically.
When I'm trying to open opensea.io with selenium it's giving Cloudfare captcha, even if I solve the captcha the captcha page is not redirecting to opensea.io
Update: Installing vpn solved this but there must be other ways.
driver.get("https://opensea.io")
Error screenshot given below.
cloudfare error
Edited:
There might be several reasons that are possibly causing this kind of problem:
Cloudflare blocked your I.P. Try using a new I.P. through a proxy (or VPN, Another ISP), and see if it works or not. (https://community.cloudflare.com/t/cant-bypass-cloudflare-captcha/200335/8)
Depending on Selenium versions and editions, it could explicitly tell the browser that it is a bot and allow the websites to know it is Selenium, so Cloudflare then blocks the request.
The browser is the problem. Try a different browser like Firefox.
Cloudflare or the website you are trying to reach cares about special cookies that are not available on a Selenium new browser (This was my wild guess, but it's not the case).
P.S.: I have tried to connect to this URL (https://opensea.io), and interestingly, it worked fine for me.
Here is some information about the environment I performed this action on:
Operation System: CentOS 7, Linux
Selenium Standalone Version: 4.0.0
Java Version: jre-8u311-linux-x64
The browser I used: Firefox
when I try to use python + Selenium to run my code, the error message shows in the terminal during the program is running, it has no effect of my program, but sort of annoying, does anyone have any solution to tell me why the error shows, and how to disable the error message.
my network is located in China, and our network policy disables the access to Google, is the may the cause?
[21792:15920:1230/144009.402:ERROR:gcm_channel_status_request.cc(145)] GCM channel request failed.
anyway, thanks in advance.
Note: This is not a definitive answer; it is very rough conclusions drawn from a quick investigation.
GCN is Google Cloud Messaging. It appears that the Selenium Chrome extension is using GCN. See for example https://pushwizard.com/chrome-gcm-messaging.
I see these messages when my Python Selenium Chrome application is sleeping and I hibernate the machine. It may occur at other times.
I surmise that the Selenium Python backend is using GCN and uses a ping or keep-alive type of message to find out if the Chrome browser is still there. I further surmise that since my Python application takes much less memory than the Chrome browser, my app wakes up first, pings the browser, and reports that there was no response.
Since it's not causing a problem this is enough for me.
Google Cloud Messaging is deprecated - you should use Firebase Cloud Messaging instead.
You may need to update your selenium webdriver for chrome.
Since your access to google ( and I think google services too ) is disabled this also could be the issue. To test this, you should go and implement the selenium application with firefox (or any other non chromium based browser) ; which shouldn't use google services inherently. ( but i am not 100% sure about that )
I am using selenium to open a web browser (specifically Chrome) in order to login to an account. When I run my script, there is a modal dialog box that lets the user know there is an error with administrative permissions. Once the user clicks "Okay", the rest of the script runs without issue.
The problem is I need this script to run automatically. Is there a way to use Python to click the "Okay" button? The alert is not within Chrome, so .switch_to_alert() is not helpful. I've found this question asked previously but the response makes it clear it can't be done with selenium, but can it be done another way?
I've also found this source on using ctypes to handle, but I'm unable to install ctypes.
Any tips/help would be appreciated!
I did further research and it appears that a system modal dialog box cannot be accessed with Python.
I was able to prevent the pop up from occurring at all by getting an older version of the chromedriver. Instead of the most updated (ChromeDriver 2.30), I reverted back to ChromeDriver 2.27 and my program worked without issue.