Timeout after launching IE using Selenium - python

I am trying to execute the code below. After launching the provided URL on the IE browser, the next line of code times out and does not get executed.
Please help!
Apps and version:
Selenium: 3.141
Python: 3.8
Pycharm IDE: 2020.1
Code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Ie(executable_path="...\IEDriverServer.exe")
driver.get("https://google.co.in") # Launch is successful.
print(7+7) # This is not executed. The process times out.

I am able to proceed now.
I was using 64bit IE-driver, I tried with 32-bit now which is allowing me to proceed after browser launch.
No time-out observed.
Thanks

Related

Selenium webdriver seems not working properly with Firefox 49.0. Am I missing something?

I have gone through previous questions but did not find anyone else running into my issue.
This simple code hangs
from selenium import webdriver
d = webdriver.Firefox();
The browser gets launched, but it just hangs there. After sometime, it crashes and I get the error
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.
Profile Dir: /tmp/tmpn_MQnf If you specified a log_file in the
FirefoxBinary constructor, check it for details.
I have Firefox49 on Ubuntu 14.04 LTS. I had selenium 2.53.6 and reading a previous post, I upgraded to selenium 3.0.0.b3. I also downloaded geckdriver and put it in /usr/bin
It looks like I was still running older version of selenium. But when I uninstalled that and installed selenium 3.0.0.b3, I see the following error -
selenium.‌​common.exceptions.We‌​bDriverException:
Message: Service geckodriver unexpectedly exited. Status code was: 2
What am I missing?
Try renaming the downloaded Gecko Driver to Wires and Set the Capabilities as mentioned Below.
System.setProperty("webdriver.gecko.driver", "//home//.....//BrowserDrivers//wires");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
Driver = new MarionetteDriver(capabilities);
I tried with the Above code on FireFox 49 on Linux Ubuntu 14.04 LTS... Code Works Fine For Me in Java..
Also try to downgrade the selenium WebDriver from Beta to 2.53 as Beta version is unstable..

Page is not loaded in Selenium WebDriver using Python on Windows

I am using Python 3.5 on a Windows computer. When I run this code on my Mac it works perfect, no issues what so ever. But when I bring the code to my Windows computer it doesn't work.
Basically a blank page is shown instead of the home page. I don't get any error messages.
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.google.com')
cookies = driver.get_cookies()
print(cookies)
Once I close the web browser I get this message in the shell:
"The browser appears to have exited "
selenium.common.exceptions.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.
From what I've been able to find online (most is for Java) it looks like I may need to setup a profile? Is this correct and could anyone help with this?
It looks like your client doesn't have the fix for the new switch to launch the gecko driver:
https://github.com/SeleniumHQ/selenium/commit/c76917839c868603c9ab494d8aa0e9d600515371
Make sure that you have the latest beta version installed (selenium-3.0.0b2) if you which to use the geckodriver v0.10.0 and above:
pip install -U selenium --pre
Note that you need the --pre flag to install the beta version.

Selenium-Firefox: Firefox browser crashes when running my Selenium script [duplicate]

This question already has answers here:
Can't open browser with Selenium after Firefox update
(7 answers)
Closed 6 years ago.
I was running some scripts I had developed in Selenium-Python today. They were working just fine. When I closed out a window & went to re-run a test, the Firefox browser that opened up would crash & my script would fail. This literally happened one second to the next. I wasn't sure what had changed to cause this.
I'm running Selenium 2.53 & Firefox 47 on my machine. Occasionally when I try to run my script again, I will get this run error in Pycharm:
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 98, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.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.
Normally I just get an error when I manually close the crashed FireFox browser that opens. Any ideas as to what occurred?
I also had issues with Firefox 47 and Selenium. You could try reverting back to a previous version of Firefox and disabling updates.
Previous versions of Firefox and instructions on how to disable automatic updates can be found here:
https://support.mozilla.org/en-US/kb/install-older-version-of-firefox
According to
Firefox 47 release notes (June 7, 2016):
Unresolved: Selenium WebDriver may cause Firefox to crash on startup, use Marionette WebDriver instead
I would like to slightly correct previous answer. Working example is below:
Preliminary:
Download geckodriver.zip from https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver;
Extract geckodriver.exe to the directory where this script is located.
Run script:
# -*- coding: utf-8 -*-
import os
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
gecko = os.path.normpath(os.path.join(os.path.dirname(__file__), 'geckodriver'))
browser = webdriver.Firefox(capabilities=firefox_capabilities, executable_path=gecko+'.exe')
browser.get('http:///www.google.com')
browser.close()
# browser.quit()

launchd failing to run python script with phantomJS

I have a python script that does some things online. Every 10 seconds launchd (OSX 10.11.3 El Capitan) launches a shell script, which calls the python script, which goes online using selenium webdriver.PhantomJS() (or should).
When running the shell script from the terminal, everything succeeds. When running in the configuration described above but with webdriver.Firefox() instead of webdriver.PhantomJS(), everything succeeds. However, when running through launchd -> shell -> python with webdriver.PhantomJS(), it exits with abnormal code: 1.
A simplified version of my code (with all the imports):
from selenium import webdriver
import selenium.webdriver.support.ui as ui
from selenium.common.exceptions import NoSuchElementException
d = webdriver.PhantomJS()
d.close()
What am I missing? I would suspect full path names, but I do not explicitly import Firefox() either, and that does work...
Is it failing on an import failure? I had a similar-sounding problem, outlined here: Running Python Script with Launchd: imports not found
What was helpful: using LaunchControl, capturing Standard Error, and finding out python could not import a specific package. Not sure if that's your problem, but Standard Error will tell you what abnormal code: 1 actually is.

Firefox won't 'drive' with Selenium webdriver

I've used Firefox with Webdriver on this machine before, but suddenly when I use any code that utilizes Firefox as the driver, Firefox will open and just sit there blankly. Absolutely nothing loads, my program hangs until I close the window at which point it raises the "browser not open" error.
Tried reinstalling. Chrome/IE Drivers work but I don't really want to use them.
Included a pic of exactly what happens when I use any code, for instance
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
url = "http://google.com"
driver.get(url)
Even this gets me nothing.
upgrade to selenium version 2.29.0
pip install -U selenium
there was a bug fix in the previous version

Categories