kybu / headless-selenium-for-win Goto Github PK
View Code? Open in Web Editor NEWRunning Selenium driven browsers headlessly on Windows.
License: GNU General Public License v3.0
Running Selenium driven browsers headlessly on Windows.
License: GNU General Public License v3.0
hey, kybu,
First of all thank you for your code.
while I am struggling with multi-IEs in one windows VM problem and I found your code.
I googled a lot and found suggestion creating more VMs only.
I am using java8 and selenium3 with remote web driver located at windows7/8.1/10+IE11. I have put your headless selenium to the PATH, set up the selenium start args and its runs well.
using the util.exe to check the desktops and I can switch to it to see the IE too.
But I found one thing that if I DO NOT switch to the certain desktop, the selenium API (for example, CLICK or SENDKEYS etc) seems not work at all,although the selenium API such as navigate or findelement work well.
Am I missing something or can you give me some hint to let it work?
OR is it just like what the selenium group's IE wiki says, the windows IE need focus and IE sucks and can not be solved?
Hey,
I am using Selenium and Python 3.5.2. When I use the visible IE Web Driver:
print("Loading IE...")
browser = webdriver.Ie()
print("IE Loaded")
browser.get("http://www.google.com")
The browser loads and runs fine.
As soon as I switch to:
browser = webdriver.Ie("C:\Program Files\Python\Scripts\headless_ie_selenium.exe")
this line of code runs, then hangs. The second print statement is never reached.
"C:\Program Files\Python\Scripts\headless_ie_selenium.exe" is in the PATH, along with IEDriverServer.exe - which is also in the same folder as the headless_ie_selenium.exe file.
desktop_utils.exe was also copied to the same location, does this need to be added to PATH as well? Why would it hang without error message?
Update:
It does seem to start the IEServerDriver as a process and when hitting ctrl+c to force close the scripts execution, it has errors with the request.py.
Trying to use it on Windows 2012 but getting stuck. See that the HeadlessDesktop(verified with desktop_utils -l) starts up when I run my tests.
Hi,
I wanted to ask question about driver configuration
as per wiki mentioned - HEADLESS_DRIVER should be configure to geckodriver.exe.
where i can configure, can you please provide sample for it
I was able to get this working with Chrome though Firefox it tended to have issues. Does this support extensions headlessly if so that's awesome
First off thanks for this great project, it's one of the only solutions i could find for headless IE.
Now for the issue, i have a windows slave that I want to run selenium tests on using the headless selenium driver.
When trying to run the tests manually from the windows slave using the headless selenium driver it runs without issues.
But when i try and run the tests from jenkins using the windows slave agent it cannot find any elements and screenshots return a blackscreen.
I'm really desperate to run my tests for IE on the windows slave, hopefully you can help me.
If you need any further information just let me know
System information:
Windows 10 windows slave
Jenkins version 2.73.1
Logs:
Started InternetExplorerDriver server (32-bit)
3.6.0.0
Listening on port 19936
Log level is set to WARN
Only local connections are allowed
okt 12, 2017 1:44:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
W 2017-10-12 13:44:40:554 CommandHandlers\SendKeysCommandHandler.cpp(238) Specified element is not the active element. Keystrokes may go to an unexpected DOM element.
W 2017-10-12 13:44:41:765 CommandHandlers\SendKeysCommandHandler.cpp(238) Specified element is not the active element. Keystrokes may go to an unexpected DOM element.
Started InternetExplorerDriver server (32-bit)
3.6.0.0
Listening on port 13178
Log level is set to WARN
Only local connections are allowed
okt 12, 2017 1:45:20 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Scenario: Login with admin credentials # Login.feature:4
Given Start application # StartDefinition.startApplication()
When login user "admin" with password "admin" # StartDefinition.loginUserAndPassword(String,String)
Then find inputfield: "form-header-search:search-general_input" # ElementDefinition.findInputfield(String)
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.id: form-header-search:search-general_input (tried for 15 second(s) with 500 MILLISECONDS interval)
i am using headless ie browser for my testing. but after the test is completed, other windows like notepad, cmd, etc are minimized on top of the taskbar. Is it a expected behavior because of virtual desktop or a bug. please clarify my doubt.
How can we connect to the virtual desktops via VNC?
My IEDriverServer.exe is added to
I'm trying to use it like this:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Ie('C:\IEDriverServer_Win32_3.150.1\headless_ie_selenium.exe')
# --------------- BEGIN: Login to PS/CAS -------------------#
browser.get('www.someurl.com')
assert 'American Express' in browser.title
I'm pasting the traceback below
Traceback (most recent call last):
File "C:\Users\hjind\Desktop\pythonRCM\headless_ie.py", line 16, in <module>
browser = webdriver.Ie('C:\IEDriverServer_Win32_3.150.1\headless_ie_selenium.exe')
File "C:\Users\hjind\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium-3.141.0-py3.9.egg\selenium\webdriver\ie\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\hjind\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium-3.141.0-py3.9.egg\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\hjind\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium-3.141.0-py3.9.egg\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\hjind\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium-3.141.0-py3.9.egg\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\hjind\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium-3.141.0-py3.9.egg\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:57762/'
It is not like this app does not do any error handling but a few things can be improved.
Hello!
Congratulations on developing desktop_utils. It really is a program that helps me a lot.
There is a small problem. Every time a program is run on a virtual desktop, a new process "explorer.exe" is started.
It would be interesting if we could pass a parameter to not start this process...
Thank you very much in advance.
now I can create multi desktops, and swtich to each other;
when testscript run parallel in these desktops, I want view the windows in real time, but now i can't do it.
Hello!
I'm running into an issue when trying to run headless on Windows 2012 R2 with Scheduled Tasks.
Its not working. Stand alone, it works.
Logs:
2017-01-31 14:02:48,931 POST http://127.0.0.1:54423/session {"requiredCapabilities": {}, "desiredCapabilities": {"platform": "WINDOWS", "browserName": "internet explorer", "version": "", "javascriptEnabled": true}}
2017-01-31 14:02:48,963 Finished Request
nothing else after that.
Stand alone:
2017-01-31 14:08:30,842 POST http://127.0.0.1:54476/session {"requiredCapabilities": {}, "desiredCapabilities": {"platform": "WINDOWS", "browserName": "internet explorer", "version": "", "javascriptEnabled": true}}
2017-01-31 14:08:32,357 Finished Request
2017-01-31 14:08:32,357 <selenium.webdriver.ie.webdriver.WebDriver (session="21d32189-dd43-45b3-9e7f-33414a9a1011")>
2017-01-31 14:08:32,357 Starting Selenium
2017-01-31 14:08:32,357 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/url {"url": "URL", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011"}
2017-01-31 14:08:32,592 Finished Request
2017-01-31 14:08:32,592 Got site
2017-01-31 14:08:32,592 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "id", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "userName"}
2017-01-31 14:08:32,654 Finished Request
2017-01-31 14:08:32,654 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/d0742ab7-ac34-4aca-8e1c-c294b8d3844e/clear {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "d0742ab7-ac34-4aca-8e1c-c294b8d3844e"}
2017-01-31 14:08:32,842 Finished Request
2017-01-31 14:08:32,842 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "id", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "userName"}
2017-01-31 14:08:32,888 Finished Request
2017-01-31 14:08:32,888 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/d0742ab7-ac34-4aca-8e1c-c294b8d3844e/value {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "d0742ab7-ac34-4aca-8e1c-c294b8d3844e", "value": username}
2017-01-31 14:08:33,342 Finished Request
2017-01-31 14:08:33,342 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "id", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "password"}
2017-01-31 14:08:33,388 Finished Request
2017-01-31 14:08:33,388 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/787443f7-234c-4e75-8664-d701a7a7c275/value {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "787443f7-234c-4e75-8664-d701a7a7c275", "value": password}
2017-01-31 14:08:33,670 Finished Request
2017-01-31 14:08:33,670 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "name", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "okBT"}
2017-01-31 14:08:33,732 Finished Request
2017-01-31 14:08:33,732 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/848c8b01-bf95-4df0-beb3-42e6afb9e942/click {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "848c8b01-bf95-4df0-beb3-42e6afb9e942"}
2017-01-31 14:08:34,450 Finished Request
2017-01-31 14:08:34,450 made clicks
2017-01-31 14:08:34,450 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/url {"url": "URL", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011"}
2017-01-31 14:08:34,686 Finished Request
2017-01-31 14:08:34,686 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "name", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "attachment"}
2017-01-31 14:08:34,732 Finished Request
2017-01-31 14:08:34,732 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/4aeab561-0c3d-4995-9092-1302dee5154b/value {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "4aeab561-0c3d-4995-9092-1302dee5154b", "value": [inputting data]}
2017-01-31 14:08:37,357 Finished Request
2017-01-31 14:08:37,357 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element {"using": "name", "sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "value": "loadBT"}
2017-01-31 14:08:37,404 Finished Request
2017-01-31 14:08:37,404 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/element/d99b4902-0acf-41e3-92de-ece7261412c6/click {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "id": "d99b4902-0acf-41e3-92de-ece7261412c6"}
2017-01-31 14:08:37,592 Finished Request
2017-01-31 14:08:37,592 POST http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011/timeouts/implicit_wait {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011", "ms": 60000.0}
2017-01-31 14:08:37,607 Finished Request
2017-01-31 14:08:37,607 quiting
2017-01-31 14:08:37,607 DELETE http://127.0.0.1:54476/session/21d32189-dd43-45b3-9e7f-33414a9a1011 {"sessionId": "21d32189-dd43-45b3-9e7f-33414a9a1011"}
2017-01-31 14:08:37,638 Finished Request
Is it that selenium doesnt support running through task scheduler?
Hello how i can delete virtual desktop "HeadlessDesktop" ?
Chromedriver works fine. I am using Anaconda Python 3, but when I use geckodriver it doesn't recognise the path. A workaround was..
import os
os.environ["HEADLESS_DRIVER"] = "geckodriver.exe"
from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'C:\Users\Dan\Anaconda3\headless_ie_selenium.exe')
driver.close()
However, it doesn't act as it should. My only assumption is that as I am using 64 bit windows it is not working correctly. As you can see https://ibb.co/iy44Rv it is not closing. It seems to launch and then that's it. It also uses about 20% of cpu and i have an i7 4790k and default firefox uses less. Thanks.
Windows job objects can be used to clean up all running processes related to Selenium. http://msdn.microsoft.com/en-gb/library/windows/desktop/ms684161%28v=vs.85%29.aspx
E.g. other browsers on Windows like Chrome or Firefox can be launched like IE using driver binary. It would be great to have just an ability to specify driver binary and after starting its process simply proxy all requests to the port.
I was unable to find out proper way to pass command line arguments to application that I want to run within virtual desktop with the help of desktop_utils. For example, I want to open some URL in Firefox instance. Following command is not working:
C:\Program Files (x86)\Mozilla Firefox>desktop_utils --desktop D1 --run "firefox.exe http://masterhost.ru/"
Could not create the 'firefox.exe http://masterhost.ru/' process in the 'D1' desktop!
Is it possible to also use the default desktop?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.