Selenium Browser Issue - python

So I have been using splinter (wrapper around selenium) to automate a web browser. Recently it stopped working. It opens a browser window but doesn't go to the website.
My code:
import splinter
browser=splinter.Browser()
browser.visit('http://google.com')
The error I get is :
WebDriverException: Message: Can't load the profile. Profile Dir: c:\users\rbarnes\appdata\local\temp\tmpuaskxw If you specified a log_file in the FirefoxBinary constructor, check it for details.
Traceback points to the second line in the code. This worked perfectly fine yesterday.

Related

Website is not opening in selenium webdriver of google chrome using python

I am trying to open the website in selenium python but it is showing blank page. but when i open that website in normal google chrome it is working .
here is the code i am writing to open the website.
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("https://shop.coles.com.au/a/wentworth-point/home")
Error I am Getting in chrome console Failed to load resource: the server responded with a status of 429 () and Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME –
You must specify the chromedriver path. Something like this:
https://seleniumbyexamples.github.io/navget
Verify that version of chrome driver is same of chrome browser installed on your machine
and make sure that path of chrome driver is set in your PATH variable.
http://chromedriver.chromium.org/downloads
The error code 429 that you are getting means too many requests are sent in a given amount time. Just try to clean your build history and run it again. Regarding the version of Chrome, if that was to be the issue the browser must have not opened in the first place and you would have got other exception like SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83
Just to be sure you mat check for the version of chrome you are using and the driver downloaded in the system, if it is not appropriate download the latest chrome driver from web and provide in the executable path to chrome or else add it in environment variables of your system.

Python in Selenium Automation

I am trying to run selenium by running the below two lines of code after giving the path to chromedriver..
from selenium import webdriver
driver=webdriver.Chrome("C:/Users/Admin/Desktop/chromedriver")
But its not working and displaying the below error.
selenium.common.exceptions.WebDriverException: Message: Service C:/Users/Admin/Desktop/chromedriver unexpectedly exited. Status code was: 1
Can you please tell how to fix it ?
Check your chrome brower version and download chromedriver accordingly from below url https://sites.google.com/a/chromium.org/chromedriver/downloads
from selenium import webdriver
browser = webdriver.Chrome(executable_path=r" path of chromedriver.exe")
browser.get('your url')
i think you are missing some libraries, i had a similar problem when i was trying stuff with selenium. try installing the chromium driver as well cause it might have the libraries you need, even if you don't want to use chromium

Python Selenium Firefox Accessibility issue

I tried selenium in Python to open a Google page, however, instead of loading the page, the Firefox browser keeps telling me the Accessibility issue. I followed the instruction to change the settings but can not find it!
Besides, I found a solution to a similar problem - Webdriver.get(url) open Firefox but not the URL, but after I linked geckodriver, the Accessibility problem is till there.
Could someone please help? Tens of Thanks in advance!!!!!
from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'path\geckodriver.exe')
driver.get('http://www.google/com')
Screenshot - Accessibility issue
Screenshot - Firefox instruction
Screenshot - Can not find the setting

python cannot run selenium tests in firefox but pytest can

I'm using pytest with selenium. I have a simple setup:
browser = webdriver.Firefox()
when running the test file with py.test test_foo.py
The firefox browser launched correctly, got the url and executed the test with no problem.
Then i created another python file testsuite1.py which contains
pytest.main('py.test test_foo.py')
I ran python testsuite1.py, it opens the Firefox browser but failed to get the URL and finish the test. The error that it failed on:
WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
I googled many different posts on this issue and I couldn't find any solutions. I've updated to Selenium 2.47.1, using Firefox 40. I don't understand why it would work with py.test command and not pytest.main within python.
Any ideas?

Cannot create browser process when using selenium from python on RHEL5

I'm trying to use selenium from python but I'm having a problem running it on a RHEL5.5 server. I don't seem to be able to really start firefox.
from selenium import webdriver
b = webdriver.Firefox()
On my laptop with ubuntu this works fine and it starts a brings up a firefox window. When I log in to the server with ssh I can run firefox from the command line and get it displayed on my laptop. It is clearly firefox from the server since it has the RHEL5.5 home page.
When I run the python script above on the server it (or run it in ipython) the script hangs at webdriver.Firefox()
I have also tried
from selenium import webdriver
fb = webdriver.FirefoxProfile()
fb.native_events_enabled=True
b=webdriver.Firefox(fb)
Which also hangs on the final line there.
I'm using python2.7 installed in /opt/python2.7. In installed selenium with /opt/python2.7/pip-2.7.
I can see the firefox process on the server with top and it is using a lot of CPU. I can also see from /proc/#/environ that the DISPLAY is set to localhost:10.0 which seems right.
How can I get a browser started with selenium on RHEL5.5? How can I figure out why Firefox is not starting?
It looks like the problem I'm encountering is this selenium bug:
http://code.google.com/p/selenium/issues/detail?id=2852
I used the fix described in comment #9 http://code.google.com/p/selenium/issues/detail?id=2852#c9
That worked for me.

Categories