seleniumhq / selenium Goto Github PK
View Code? Open in Web Editor NEWA browser automation framework and ecosystem.
Home Page: https://selenium.dev
License: Apache License 2.0
A browser automation framework and ecosystem.
Home Page: https://selenium.dev
License: Apache License 2.0
Please refer the update section at Webdriver unable to create session with phantomjs
I am trying to screen capture a web page (www.constructionequipment.com) using PhantomJSDriver, which works fine locally on my development box but when ran from a web server (without a display) does not properly handle detection of the screen due to the responsive nature of the web page.
What I am seeing happen (on the server) is the horizontal navigation bar at the top of the page always appears to display in a mobile mode (for responsive design) when screen captured, this is regardless of any width that I force the browser window to.
What I am seeing happen (on my development box) is the responsive menu adjusts appropriately as I resize the window programmatically. No issue here.
I was looking at the CSS for www.constructionequipment.com and found a media query being used ("@media" screen) which provides conditional logic for which CSS block to use based on the screen size.
I am thinking that the PhantomJS Driver is (in the case of running on the server) not properly detecting the screen width (since there is no display).
It should be noted that other responsive websites like CNN.com for example, work fine.
Has anyone else encountered this issue?
Thanks in advance.
Below is an attached screen capture of a dropdown menu in a wide browser window (which should be using a navigation bar instead). This was captured by my application running in a server environment and illustrates the problem I am seeing. My application works fine when ran locally.
You can go to constructionequipment.com and horizontally resize the window to see how it should behave.
Custom .NET/C# application using...
Selenium WebDriver API .NET Bindings
Runtime Version v4.0.30319
Version 2.44.0.0
phantomjs.exe
Development machine: Windows 7
Server machine: Win Server 2008 R2
.NET version v4.0.30319
Information about CSS @media queries
http://stackoverflow.com/questions/4189868/what-does-media-screen-and-max-width-1024px-mean-in-css
I believe that there is unnecessary lock.unlock() method call in org.openqa.selenium.firefox.FirefoxDriver.java (selenium/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java) at line 282 in finally block. lock.lock(..) is never called before said unlock.
According to file history it was necessary earlier when lock was actually locked before that unlock. But now locking is performed in NewProfileExtensionConnection in start() method.
Selenium typically writes Firefox profile files in /tmp/ as temporary directory (/tmp/tmpXXXXXX).
This is OK as long as everything goes well and driver.quit()
is called, cleaning the directories.
In my case, selenium is running under Xvfb, managed by a supervisord
, and it looks like in some cases, my files are not cleaned. It would be cool to store all this tmp files elsewhere, so I can easily rm -fr
them.
My supervisord config, FYI looks like:
[program:tests-example-com]
user=nobody
command=/home/.../test.py -v run-with-browser http://www.example.com/what-to-test/
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stopsignal=QUIT
My python code, FYI looks like a context manager to be sure to not forgot driver.quit.:
[...]
class WhateverTester:
[...]
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
self.driver.quit()
[...]
with WhateverTester(endpoint) as tester:
tester.run()
[...]
The changelog link for the java 2.45.0 release on the http://www.seleniumhq.org/download/ page leads to 404 page
I have installed pip, selenium sucessfully but when I run python script, I am geeting erro on line "from selenium import webdriver" as ImportError: cannot import name 'webdriver'.
I recently started working on selenium python.
could you please help in resolving this issue?
See this test on Sauce Labs:
https://saucelabs.com/tests/c1d1d933b9b64132b25a2663fe71e52b
On a real Mac, entering a number, clicking next, and clicking submit work fine. In Selenium, it seems like a change event does not fire on the input
element.
Here is the relevant test code:
https://github.com/SEL-Columbia/dokomoforms/blob/b1204676d74caf1ae52aa7f368c3c92fd8cb0fa0/tests/selenium_test.py#L283-L311
Hello as mentioned in the tutorial i cloned the git repo, however on doing the ./go iPhone ; i am unable to get the device. I made sure the device is in the network and is connected. is there a detailed tutorial for using actual physical devices?? if yes please share it with me screenshots will also be helpful . thanks in advance
I have a webpage whose structure looks like this
[checkbox1]
[some text1] [textbox1]
[checkbox2]
[some text2] [textbox2]
I am trying to find a logic where, if i click on checkbox1, textbox1 should be focused and allow me to enter text, if checkbox2 is checked, when i enter text, it should automatically fill in textbox2.
Can someone please help
I've noticed that ClickTest.testShouldOnlyFollowHrefOnce fails sometimes (but at a very low rate) because it closes the original window instead of the newly-opened window.
Specifically, this switchTo() doesn't work, so the following close() closes the "main" window, and additionally causes the switchTo() in the finally block to fail, resulting in an error like this:
java.lang.RuntimeException: org.junit.internal.runners.model.MultipleFailureException: There were 2 errors:
org.openqa.selenium.NoSuchWindowException(Unable to locate window "{a46823e9-4fa9-46de-8663-5e44cf4b2a67}"
Command duration or timeout: 2.13 seconds)
org.openqa.selenium.NoSuchWindowException(Window not found. The browser window may have been closed.
Command duration or timeout: 73 milliseconds)
From adding some logging, what's happening when the test fails is that getWindowHandles() returns two handles, one of which is the empty string. That empty string is returned by the FirefoxDriver here if win.top.fxdriver
doesn't exist.
Calling getWindowHandles() again a short time later always yields two non-empty window handles.
Giving the new window a name by modifying the JS window.open call here doesn't seem to eliminate occurrences of this empty string, so perhaps this is happening if the new window hasn't finished loading yet?
A couple possible solutions that may or may not be any good (but each of which fixes the flakiness in my testing):
As one more footnote, I don't think I've seen this failure mode in [http://ci.seleniumhq.org:8080/](Selenium's Jenkins CI), but when I'm running the tests locally, the local and remote ends are both on the same machine (which isn't the case for the CI, AFAIU), so the low latency of sending commands to the browser might tickle the bug.
Selenium Grid2 Wiki page says:
-timeout 30 (300 is default) The timeout in seconds ...
But in SelfRegisteringRemote.java source file, at line 97 we have divide by 1000 as if we're using the value of the "-timeout" parameter in milliseconds:
if (hubParameters.has(CLIENT_TIMEOUT)){
int timeout = hubParameters.get(CLIENT_TIMEOUT).getAsInt() / 1000;
remoteControlConfiguration.setTimeoutInSeconds(timeout);
}
We should either to update source code or documentation.
e.g.
var fs = require('fs');
var webdriver = require('selenium-webdriver');
var remote = new webdriver
.Builder()
.withCapabilities({ browserName: 'phantomjs' })
.build();
remote.manage().window().setSize(1024, 900);
remote.get('http://google.com');
setTimeout(function() {
remote.executeScript('return true').then(log, onError);
}, 500);
function log(res) { console.log(res); }
function onError(e) { throw e; }
This small program gets stuck and never ends, but it we move the line remote.executeScript('return true').then(log, onError);
out of the setTimeout
callback then it starts working as expected.
Shouldn't the executeScript
call schedule the operation regardless of when it is called?
I'm using [email protected]
Happens with PYHTON 2.7.x
D:\CodeRoot\node_
lenium-webdriver\node_modules\ws\node_modules\utf-8-validate>if not de
config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\no
\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuil
gyp ERR! configure error
gyp ERR! stack Error: spawn C:\Python34 ENOENT
gyp ERR! stack at exports._errnoException (util.js:746:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_proce
:32)
gyp ERR! stack at child_process.js:1137:20
gyp ERR! stack at process._tickCallback (node.js:355:11)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\CodeRoot\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-valid
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
[email protected] node_modules\selenium-webdriver
โโโ [email protected]
โโโ [email protected]
โโโ [email protected] ([email protected], [email protected])
โโโ [email protected] ([email protected])
โโโ [email protected] ([email protected], [email protected])
Is there a command to retrieve the browser's console output? This for various log levels, preferable as an event?
This feature has been raised in the WebdriverIO repository at webdriverio/webdriverio#464 but it seems that this is rather a Selenium thing.
Let me know if this is already implemented or on your todo list. Thanks
After installing a new version of IDE (2.9.0) on FF 36.0.4 on a windows seven machine, I'm am getting an endless stream of error popups, if I open the actions or the options drop-down. I am also seeing what another user reported: "Table view is not available with this format" Examples below:
Hi Folks,
Was Searching google for long hrs to find solution to resume Driver object but didn't find a concrete solution, so that I thought it would be a good idea to Serialize Driver instance and load it again when we rerun.
I am trying to achieve this to expedite automation development process, everytime I rerun the test while development I have to close the browser and re launch it again and again this is very annoying.
So thought that below code would help me, but it is throwing exception that InternetExplorerDriver is not implementing Serializable.
Can someone please help me to fork this class and make it Serializable.
class WebDriverExtention {
public static WebDriver getDriverObject(){
WebDriver driver;
File f = new File("c:\\tmp\\driver.ser");
if (!f.exists()){
System.setProperty("webdriver.ie.driver","IEDriverServer32.exe");
driver = new InternetExplorerDriver();
FileOutputStream fout = new FileOutputStream("c:\\tmp\\driver.ser");
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(driver);
oos.close();
return driver;
}
else{
f = null;
FileInputStream fileIn = new FileInputStream("c:\\tmp\\driver.ser");
ObjectInputStream ins = new ObjectInputStream(fileIn);
driver = (WebDriver) ins.readObject();
ins.close();
fileIn.close();
return driver;
}
}
}
For example, if one capabilities object is
chromeOptions: {
args: '--foo'
}
and the other is
chromeOptions: {
binary: '/path/to/chrome'
}
then capabilities.merge
will override the entire chromeOptions
object instead of combining into one with both properties.
I'm not sure if this is working as intended or not, but it's causing some unexpected effects when merging.
Allowing a session_id to be set on the WebDriver would allow reuse of an existing session.
Tested working.
selenium/webdriver/remote/webdriver.py - class WebDriver
doc says:
" - session_id - The session ID to send with every command."
Added session_id=None to init
...
self.session_id = None changed to self.session_id = session_id
...
Changed to quash new session if a session id is specified
if session_id is None: # Do not start a new session if there is already a session id
self.start_session(desired_capabilities, browser_profile)
When using synthetic events, the command execution of sendKeys command sometimes fails because the javascript could not be executed.
Although the failure is detected (see the log excerpt), the response status is set to 0, indicating success.
Therefor org.openqa.selenium.remote.RemoteWebDriver.execute will not throw an exception
T 2015-03-26 01:00:24:008 server.cc(370) Entering Server::SendResponseToClient
T 2015-03-26 01:00:24:008 response.cc(33) Entering Response::Deserialize
T 2015-03-26 01:00:24:008 server.cc(424) Entering Server::SendHttpOk
T 2015-03-26 01:00:24:008 server.cc(136) Entering Server::ProcessRequest
T 2015-03-26 01:00:24:008 server.cc(200) Entering Server::ReadRequestBody
T 2015-03-26 01:00:24:008 server.cc(145) Process request with: URI: /session/f79dbb70-5180-4eaf-90f3-ad1c3c87ad6e/element/0dfbc107-e8a5-420a-87f8-42fc821d23a0/value HTTP verb: POST
body: {"id":"0dfbc107-e8a5-420a-87f8-42fc821d23a0","value":["๎"]}
T 2015-03-26 01:00:24:008 server.cc(234) Entering Server::DispatchCommand
T 2015-03-26 01:00:24:008 server.cc(541) Entering Server::LookupCommand
D 2015-03-26 01:00:24:008 server.cc(243) Command: POST /session/f79dbb70-5180-4eaf-90f3-ad1c3c87ad6e/element/0dfbc107-e8a5-420a-87f8-42fc821d23a0/value {"id":"0dfbc107-e8a5-420a-87f8-42fc821d23a0","value":["๎"]}
T 2015-03-26 01:00:24:008 server.cc(357) Entering Server::LookupSession
T 2015-03-26 01:00:24:008 IESession.cpp(212) Entering IESession::ExecuteCommand
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(158) Entering IECommandExecutor::OnSetCommand
T 2015-03-26 01:00:24:008 command.cc(28) Entering Command::Deserialize
D 2015-03-26 01:00:24:008 command.cc(33) Raw JSON command: { "name" : "sendKeys", "locator" : { "sessionid" : "f79dbb70-5180-4eaf-90f3-ad1c3c87ad6e", "id" : "0dfbc107-e8a5-420a-87f8-42fc821d23a0" }, "parameters" : {"id":"0dfbc107-e8a5-420a-87f8-42fc821d23a0","value":["๎"]} }
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(169) Entering IECommandExecutor::OnExecCommand
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(470) Entering IECommandExecutor::DispatchCommand
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(586) Entering IECommandExecutor::GetCurrentBrowser
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(592) Entering IECommandExecutor::GetManagedBrowser
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(542) Entering IECommandExecutor::IsAlertActive
T 2015-03-26 01:00:24:008 Browser.cpp(679) Entering Browser::GetActiveDialogWindowHandle
T 2015-03-26 01:00:24:008 Browser.cpp(192) Entering Browser::GetContentWindowHandle
D 2015-03-26 01:00:24:008 IECommandExecutor.cpp(556) No alert handle is found
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(586) Entering IECommandExecutor::GetCurrentBrowser
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(592) Entering IECommandExecutor::GetManagedBrowser
T 2015-03-26 01:00:24:008 Browser.cpp(192) Entering Browser::GetContentWindowHandle
T 2015-03-26 01:00:24:008 Browser.cpp(402) Entering Browser::GetTopLevelWindowHandle
T 2015-03-26 01:00:24:008 IESession.cpp(233) Beginning wait for response length to be not zero
T 2015-03-26 01:00:24:008 IECommandHandler.cpp(37) Entering IECommandHandler::GetElement
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(679) Entering IECommandExecutor::GetManagedElement
T 2015-03-26 01:00:24:008 ElementRepository.cpp(28) Entering ElementRepository::GetManagedElement
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(586) Entering IECommandExecutor::GetCurrentBrowser
T 2015-03-26 01:00:24:008 IECommandExecutor.cpp(592) Entering IECommandExecutor::GetManagedBrowser
T 2015-03-26 01:00:24:008 Browser.cpp(112) Entering Browser::GetDocument
I 2015-03-26 01:00:24:008 Browser.cpp(116) No child frame focus. Focus is on top-level frame
T 2015-03-26 01:00:24:018 Browser.cpp(579) Entering Browser::GetDocumentFromWindow
T 2015-03-26 01:00:24:018 Element.cpp(81) Entering Element::IsDisplayed
T 2015-03-26 01:00:24:018 Element.cpp(896) Entering Element::GetContainingDocument
T 2015-03-26 01:00:24:018 Script.cpp(41) Entering Script::Initialize
T 2015-03-26 01:00:24:018 Script.cpp(91) Entering Script::AddArgument(IHTMLElement*)
T 2015-03-26 01:00:24:018 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:018 Script.cpp(80) Entering Script::AddArgument(bool)
T 2015-03-26 01:00:24:018 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:018 Script.cpp(161) Entering Script::Execute
T 2015-03-26 01:00:24:018 Script.cpp(469) Entering Script::CreateAnonymousFunction
T 2015-03-26 01:00:24:038 Element.cpp(125) Entering Element::IsEnabled
T 2015-03-26 01:00:24:038 Element.cpp(896) Entering Element::GetContainingDocument
T 2015-03-26 01:00:24:038 Script.cpp(41) Entering Script::Initialize
T 2015-03-26 01:00:24:038 Script.cpp(91) Entering Script::AddArgument(IHTMLElement*)
T 2015-03-26 01:00:24:038 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:038 Script.cpp(161) Entering Script::Execute
T 2015-03-26 01:00:24:038 Script.cpp(469) Entering Script::CreateAnonymousFunction
T 2015-03-26 01:00:24:048 Element.cpp(302) Entering Element::GetLocationOnceScrolledIntoView
T 2015-03-26 01:00:24:048 Element.cpp(433) Entering Element::GetLocation
T 2015-03-26 01:00:24:048 Element.cpp(569) Entering Element::IsInline
D 2015-03-26 01:00:24:048 Element.cpp(479) Element is a block element, using IHTMLElement2::getBoundingClientRect
T 2015-03-26 01:00:24:058 Element.cpp(590) Entering Element::RectHasNonZeroDimensions
T 2015-03-26 01:00:24:058 Element.cpp(606) Entering Element::GetFrameDetails
T 2015-03-26 01:00:24:058 Element.cpp(896) Entering Element::GetContainingDocument
D 2015-03-26 01:00:24:068 Element.cpp(556) Element is not in a frame
T 2015-03-26 01:00:24:068 Element.cpp(845) Entering Element::CalculateClickPoint
T 2015-03-26 01:00:24:068 Element.cpp(784) Entering Element::GetClickableViewPortLocation
T 2015-03-26 01:00:24:068 Element.cpp(896) Entering Element::GetContainingDocument
T 2015-03-26 01:00:24:068 DocumentHost.cpp(401) Entering DocumentHost::GetDocumentMode
T 2015-03-26 01:00:24:068 Element.cpp(871) Entering Element::IsLocationInViewPort
T 2015-03-26 01:00:24:068 Element.cpp(784) Entering Element::GetClickableViewPortLocation
T 2015-03-26 01:00:24:068 Element.cpp(896) Entering Element::GetContainingDocument
T 2015-03-26 01:00:24:068 DocumentHost.cpp(401) Entering DocumentHost::GetDocumentMode
T 2015-03-26 01:00:24:078 Element.cpp(369) Entering Element::IsHiddenByOverflow
T 2015-03-26 01:00:24:078 Element.cpp(896) Entering Element::GetContainingDocument
T 2015-03-26 01:00:24:078 Script.cpp(41) Entering Script::Initialize
T 2015-03-26 01:00:24:078 Script.cpp(91) Entering Script::AddArgument(IHTMLElement*)
T 2015-03-26 01:00:24:078 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:078 Script.cpp(161) Entering Script::Execute
T 2015-03-26 01:00:24:078 Script.cpp(469) Entering Script::CreateAnonymousFunction
T 2015-03-26 01:00:24:098 Script.cpp(425) Entering Script::ConvertResultToString
D 2015-03-26 01:00:24:098 Script.cpp(436) Result type is string
D 2015-03-26 01:00:24:098 Element.cpp(348) (x, y, w, h): 159, 228, 398, 20
T 2015-03-26 01:00:24:108 InputManager.cpp(62) Entering InputManager::PerformInputSequence
D 2015-03-26 01:00:24:108 InputManager.cpp(83) Mutex acquired for user interaction.
T 2015-03-26 01:00:24:108 InputManager.cpp(235) Entering InputManager::SetFocusToBrowser
T 2015-03-26 01:00:24:108 Browser.cpp(192) Entering Browser::GetContentWindowHandle
T 2015-03-26 01:00:24:108 Browser.cpp(402) Entering Browser::GetTopLevelWindowHandle
T 2015-03-26 01:00:24:108 Browser.cpp(402) Entering Browser::GetTopLevelWindowHandle
T 2015-03-26 01:00:24:108 InputManager.cpp(551) Entering InputManager::SendKeystrokes
D 2015-03-26 01:00:24:108 InputManager.cpp(577) Using synthetic events for sending keys
T 2015-03-26 01:00:24:108 Browser.cpp(112) Entering Browser::GetDocument
I 2015-03-26 01:00:24:108 Browser.cpp(116) No child frame focus. Focus is on top-level frame
T 2015-03-26 01:00:24:128 Browser.cpp(579) Entering Browser::GetDocumentFromWindow
T 2015-03-26 01:00:24:128 Script.cpp(41) Entering Script::Initialize
T 2015-03-26 01:00:24:128 Script.cpp(104) Entering Script::AddNullArgument
T 2015-03-26 01:00:24:128 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:128 Script.cpp(62) Entering Script::AddArgument(std::wstring)
T 2015-03-26 01:00:24:128 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:128 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:128 Script.cpp(80) Entering Script::AddArgument(bool)
T 2015-03-26 01:00:24:128 Script.cpp(97) Entering Script::AddArgument(VARIANT)
T 2015-03-26 01:00:24:128 Script.cpp(161) Entering Script::Execute
T 2015-03-26 01:00:24:128 Script.cpp(469) Entering Script::CreateAnonymousFunction
**D 2015-03-26 01:00:24:158 Script.cpp(241) -2147352319 [Unknown error 0x80020101]: Failed to execute anonymous function, no exception information retrieved
W 2015-03-26 01:00:24:158 InputManager.cpp(598) Unable to execute js to send keystrokes**
T 2015-03-26 01:00:24:158 response.cc(60) Entering Response::SetSuccessResponse
T 2015-03-26 01:00:24:158 response.cc(66) Entering Response::SetResponse
T 2015-03-26 01:00:24:158 IECommandExecutor.cpp(586) Entering IECommandExecutor::GetCurrentBrowser
T 2015-03-26 01:00:24:158 IECommandExecutor.cpp(592) Entering IECommandExecutor::GetManagedBrowser
T 2015-03-26 01:00:24:158 response.cc(48) Entering Response::Serialize
T 2015-03-26 01:00:24:158 IESession.cpp(242) Found non-zero response length
T 2015-03-26 01:00:24:158 IECommandExecutor.cpp(192) Entering IECommandExecutor::OnGetResponse
T 2015-03-26 01:00:24:158 IECommandExecutor.cpp(307) Entering IECommandExecutor::OnIsSessionValid
**D 2015-03-26 01:00:24:158 server.cc(317) Response: {"sessionId":"f79dbb70-5180-4eaf-90f3-ad1c3c87ad6e","status":0,"value":null}**
Version: 2.45.0
Bindings: Java
Browser: Chrome/FF
While the findElementsBy function takes only mere seconds to return a record set, selenium slows down at an exponential rate when performing actions on the record set.
Case in point, I have to loop over 1000 elements and perform a click on each. The findElementsBy function only takes 6 seconds to get all 1000 WebElements, however, looping over each and performing a click takes hours and gets exponentially slower as the iterator processes.
It seems there is a memory leak issue here because even simply grabbing the first element in the list and performing a click on just that element takes 30+ seconds.
When doing a singular findElementBy().click(), the action performs instantly.
I also performed a test by looping over each and simply outputting getText(). You can see as the iterator moves through that each subsequent iteration is twice as slow as the previous.
I also performed another test by getting my 1000 elements. But then I simply called findElement singular again to grab the first element and performed a click. The click still took 30+ seconds. So it seems as though there is definitely a memory issue here.
Thanks so much for the new Selenium IDE Scheduler... I'm really enjoying using it.
One suggestion, the clock tooltip reads "Turn test scheduler on/off" whether it is currently on or off. It would be great if the tooltip would make it clear which state it is in. I like how the Record icon tool tip reads either "Click to Record" or "Now Recording, Click to Stop Recording".
How about something like:
Thanks,
Jeff
Hello
I am using selenium through ruby's selenium-webdriver to create a bot, which plays a browser game for me (single player browser game, no cheating here; ) ). The problem is, that process gains memory with time, and after 3, 4 hours it needs a restart, because of memory usage and slowing down. I managed to get a profile in firefox during the increased memory time and most of the time seems to be spent in selenium internals, namely in
Connection.prototype.close
in javascript.
What I do: I create a driver object in ruby and perform some actions in infinite loop. The code is available here: https://github.com/KillaPL/automaton.
Is this possibly a memory leak in selenium internals? I am not closing the connection myself anywhere. If so, what can I do more to help fix it? If not, what am I doing wrong?
To reproduce the issue, clone the https://github.com/KillaPL/automaton, bundle install and run it. It might fail on first run, it's not bulletproof yet. It will slowly, but steadily gain memory.
Profile file from firefox I used is available here: http://speedy.sh/Dgewu/profile.json
example html:
<select>
<option value="option0">option0</option>
<option value="option1" disabled="disabled">Disabled option</option>
<option value="option2" style="visibility: hidden;">Option hidden</option>
<option value="option3" style="display: none;">Option display none</option>
</select>
options = driver.find_elements_by_tag_name("option")
options[0].click(); <- behaves as expected
options[1].click(); <- does a no-op (expected behavior IMO)
options[2].click(); chrome renders this option, firefox doesn't. Firefox doesn't allow the user to select this, but WebDriver will select this option with this call.
options[3].click(); <- no one renders this option and it isn't settable by a user... yet webdriver sets it (and thus updates the rendered UI)
Related W3C WebDriver spec bug - https://www.w3.org/Bugs/Public/show_bug.cgi?id=28143
Hi!
Right now, SelectElement does not give access to the base element's functionality. Eg. even if you need to access simple stuff as the "Displayed" property of the base element, you have to provide them separately in your PageObjects.
public IWebElement SelectBase // returns base iwebelement for checks
public SelectElement Select // wraps around SelectBase
It would be nice to make the base element accessible either through some property, or by implementing IWebElement on SelectElement (which then passes the calls on to base element essentailly)
I did the 2nd in https://github.com/FrankyBoy/selenium/commit/88ce778e3aebbced514fc522a6eed34dbac7814f to see how hard it would be, and its really just boring boilerplate.
With version 2.45.1, the behavior when the timeout is unset for driver.wait
is confusing. It will wait indefinitely if the condition is a promise, but waits for a time of 0 if the condition is a function:
var promise = require('selenium-webdriver').promise;
var donePromise = promise.delayed(1000);
promise.controlFlow().wait(donePromise); // This waits just fine.
var done = false;
setTimeout(function() {
done = true;
}, 1000);
promise.controlFlow().wait(function() {
return done;
}); // This times out and throws an error.
Should a timeout of 0 also cause wait
to wait indefinitely if the condition is a function?
Hi Selenium Devs,
I am using chromedriver and ran into the problem of process dying which results in the browser window to stop responding. I filed a bug with the chromedriver project but they referred me here. To see the actual thread please go here
To reproduce:
fire up a chrome window via chromedriver
kill the chromedriver process manually
try navigating to another url
I tried to check for if driver == null or call driver.getUrl() but that does not seem to work either.
Ideally there should be an exception thrown if the driver process was killed
Cookies returned by IE driver contain no info about domain and expiration date
(Moved from https://code.google.com/p/selenium/issues/detail?id=8509)
What steps will reproduce the problem?
Create a fixture html file called "focustest.html" with the following content:
<!DOCTYPE html>
<html>
<head>
<title>Focus Test</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
</head>
<body>
<input id="field" name="data" value="Initial Value" type="text" />
<button id="focusbtn" onclick="doFocus()">Focus</button>
<script>
function doFocus() {
document.getElementById('field').focus();
}
</script>
</body>
</html>
Create a PHPUnit test called "test.php" with the following content:
class WebTest extends PHPUnit_Extensions_Selenium2TestCase {
function setUp() {
$this->setBrowser('firefox');
$this->setBrowserUrl('http://localhost/');
}
function testFillFocusedField() {
$value = 'Chekote';
$this->url('/focustest.html');
$this->byId('focusbtn')->click();
// get the field value current length, and add backspace/delete keystrokes to remove it
$field = $this->byId('field');
$deletes = str_repeat(
PHPUnit_Extensions_Selenium2TestCase_Keys::BACKSPACE . PHPUnit_Extensions_Selenium2TestCase_Keys::DELETE,
strlen($field->value())
);
$this->keys($deletes . $value);
$this->assertEquals($value, $field->value());
}
}
Run the test:
phpunit test.php
What is the expected output?
I expect the test to pass, and the field's "Initial Value" text to be replaced with "Chekote"
What do you see instead?
The first character of the Initial Value (The "I") is deleted, but no other characters are deleted. The result is the field have the value "Chekotenitial Value".
Selenium version: 2.45
OS: Mac OS X 10.10.2
Browser: Firefox
Browser version: 31.4.0esr, 33.1.1, 34.0.5 & 36.0.1
This problem was first discovered and discussed in the MinkSelenium2Driver issues board here:
minkphp/MinkSelenium2Driver#198
It was also originally reported here. I closed it thinking a typo was causing the tests to fail, but the typo was not the only reason it was failing. Sorry for the confusion!
Driver initialization code:
DesiredCapabilities dc = new DesiredCapabilities();
dc.setBrowserName('chrome');
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
dc.setCapability(ChromeOptions.CAPABILITY, options)
RemoteWebDriver driver = new RemoteWebDriver(new URL('http://localhost:4444/wd/hub'), dc);
nodeconfig.json code:
"browserName": "chrome",
"chrome_binary": "C:\\Tools\\GoogleChromePortable\\App\\Chrome-bin\\chrome.exe"
Exception:
org.openqa.grid.common.exception.GridException: Error forwarding the new session The listener threw an exception ( listener bug )
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:114)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
I believe it has something to do with DefaultRemoteProxy.java code:
if (BrowserType.CHROME.equals(cap.get(CapabilityType.BROWSER_NAME))) {
if (session.getSlot().getCapabilities().get("chrome_binary") != null) {
JsonObject options = (JsonObject) cap.get(ChromeOptions.CAPABILITY);
if (options == null) {
options = new JsonObject();
}
options.addProperty("binary", (String) session.getSlot().getCapabilities().get("chrome_binary"));
cap.put(ChromeOptions.CAPABILITY, options);
}
Removed "chrome_binary"
from nodeconfig.json
- no exception, "start-maximized"
passed fine.
Removed dc.setCapability(ChromeOptions.CAPABILITY, options)
line - no exception, "chrome_binary"
works fine.
This isn't a direct problem with webdriver, but it does make diagnosing other problems harder. I had a bug in my chromedriver wrapper script, and it was exiting immediately. But webdriver will hang for a minute before reporting a problem, and will just report a timeout, not that the chromedriver failed/exited.
I believe the core of the problem is in javascript/node/selenium-webdriver/remote/index.js
where the command.result().then
handler will not kick the httpUtil.waitForServer
in the case the command exits early/immediately.
The patch below demonstrates the problem by adding a test for using /bin/false
as the chromedriver. It times out after a minute.
diff --git a/javascript/node/selenium-webdriver/test/chrome/options_test.js b/javascript/node/selenium-webdriver/test/chrome/options_test.js
index eab3070..39524b9 100644
--- a/javascript/node/selenium-webdriver/test/chrome/options_test.js
+++ b/javascript/node/selenium-webdriver/test/chrome/options_test.js
@@ -204,7 +204,7 @@ test.suite(function(env) {
driver.quit();
});
- describe('Chrome options', function() {
+ describe.only('Chrome options', function() {
test.it('can start Chrome with custom args', function() {
var options = new chrome.Options().
addArguments('user-agent=foo;bar');
@@ -219,5 +219,16 @@ test.suite(function(env) {
'return window.navigator.userAgent');
assert(userAgent).equalTo('foo;bar');
});
+
+ test.it('can catch bad startup script', function() {
+ var options = new chrome.Options().
+ setChromeBinaryPath('/bin/false');
+
+ driver = env.builder().
+ setChromeOptions(options).
+ build();
+
+ driver.get('nothing');
+ });
});
}, {browsers: ['chrome']});
Hi Folks,
I am new to GUI based automation Testing.
Can somebody explain me what can cause the following exception.
I thought it may be due to some time constraints so I have used expilicit wait in my Java-Selenium prog
but i was not able to resolve this issue.
org.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up
I am using selenium 2.45 web drive and Windows 7 OS.
It call the browser but didn't navigate to specified URl. But once I degrade Firefox to 35 I worked.
I want execute my tests on Firefox 36.
Please Help me
Cookies returned by Safari driver contain no info about domain and expiration date
(Moved from https://code.google.com/p/selenium/issues/detail?id=8509)
The KB3032359 update from march 10 breaks the Internet Explorer driver.
Environment:
Windows 8.1 64bit, IE11, IEDriver 32bit 2.45
To reproduce:
var driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl(@"http://www.google.com");
driver.FindElementByName("q").SendKeys("ok");
The last line throws ElementNotFoundException and the log indicates an "Access denied" error on IHTMLWindow2::execScript.
It seems to be related to execScript being deprecated:
https://connect.microsoft.com/IE/feedback/details/1062093/installation-of-kb3025390-breaks-out-of-process-javascript-execution-in-ie11
I have the registry key "FEATURE_DISABLE_INTERNAL_SECURITY_MANAGER" set to 1,
but this workaround for the kb3025390 doesn't work with this new update.
Ubuntu 14.04 recently pushed a security update which updated Chromium and Chrome Driver from version 40.0.2214.111 to 41.0.2272.76. Ever since, I am experiencing erratic problems with reaching Chromium. Basically, what happens is that Chromium starts up but a get() does not result in any action and the associated promise is never fulfilled. I am using explicit flows.
Downgrading to the vulnerable version works but, obviously, that version is no longer in the repositories. The only alternative version would be 34.0.1847.116 which does not work with selenium-webdriver 2.44+ (timeout when trying to reach Chromium) and I am not sure what version of selenium-webdriver would be compatible with this version of Chromium.
The code roughly looks like this (in Coffeescript):
webdriver = require "selenium-webdriver"
flow = new webdriver.promise.ControlFlow().
on "uncaughtException", (e) ->
console.log "Uncaught exception:", e
browser = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome().set("chromeOptions", {"args" : ["--incognito"]})).
setControlFlow(flow).
build()
browser.get "https://www.google.com"
Used versions:
SoapUI Pro v 5.1.2 (soapui-pro-maven-plugin)
Selenium 2.45 is used (selenium-java)
httpclient 4.3.6 is used
Steps to reproduce:
WsdlProject wsdlProject = new WsdlProject("");
WebDriver driver = new FirefoxDriver();
Result in Selenium 2.45:
The Browser is started but closed immediately.
Reproducible in Firefox and Chrome.
The following exception is thrown:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'xxx', ip: 'XXX.XXX.XXX.XXX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_75'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95)
at my.project.selenium.webdriver.test.foo(awda.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
Result in Selenium 2.44:
Works as expected
I was able to trace the problem down to ApacheHttpClient, line 72:
org.apache.http.HttpResponse response = fallBackExecute(context, httpMethod);
The Problem seems to be the communication between selenium and the webdriver.
From the release notes of v 2.45: "Pull HttpClient implementation details out of HttpCommandExecutor".Maybe this change is responsible for the behavior?
Take this simple example:
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
var searchBox = driver.findElement(webdriver.By.name('q'));
driver.actions().mouseMove(searchBox).perform();
searchBox.sendKeys('awesome');
searchBox.getAttribute('value').then(function (value) {
console.info('awesome');
});
driver.quit();
Run it on 2.44 and it will work just fine, fails on 2.45. Comment out the actions/perform line and it works. I have found that regardless of the placement, action, or context this command just fails now. Also this is an issue with the driver as the results are identical with every browser and versions 2.44 and 2.45 of selenium server. It also happens for every action I tried, move, click, etc
Error in this particular example:
StaleElementReferenceError: stale element reference: element is not attached to the page document
(Session info: chrome=41.0.2272.104)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Mac OS X 10.10.2 x86_64)
Though I have also seen Unknown Error: null
I am using the docker containers (2.45.0) to create a grid.
On the same host machine I run:
docker run -d -p 4444:4444 --name selenium-hub selenium/hub:2.45.0
docker run --rm --name=ff --link selenium-hub:hub selenium/node-firefox:2.45.0
The node registers properly. However once I start a test run, I see the exception below in the log. It's happening right as I attempt to create the remote webdriver.
browser = webdriver.Remote('http://client:4444/wd/hub', desired_capabilities=DesiredCapabilities.FIREFOX)
FWIW - the chromedriver node runs perfectly.
20:01:01.356 INFO - Registering the node to hub :http://172.17.0.21:4444/grid/register
20:01:13.949 INFO - Executing: [new session: Capabilities [{firefox_profile=UEsDBBQAAAAIACZoeEZh7yP8ZwMAA..., platform=ANY, javascriptEnabled=true, browserName=firefox, proxy={httpProxy=172.28.128.11:9923, sslProxy=172.28.128.11:9923, proxyType=MANUAL}, version=}]])
20:01:13.974 INFO - Creating a new session for Capabilities [{firefox_profile=UEsDBBQAAAAIACZoeEZh7yP8ZwMAA..., platform=ANY, javascriptEnabled=true, browserName=firefox, proxy={httpProxy=172.28.128.11:9923, sslProxy=172.28.128.11:9923, proxyType=MANUAL}, version=}]
20:01:59.418 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'fa59fe32da9b', ip: '172.17.0.23', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-46-generic', java.version: '1.7.0_75'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:109)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:110)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'fa59fe32da9b', ip: '172.17.0.23', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-46-generic', java.version: '1.7.0_75'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:69)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:53)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:54)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:214)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows:
(process:40): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Xlib: extension "RANDR" missing on display ":99".
process 40: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'fa59fe32da9b', ip: '172.17.0.23', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-46-generic', java.version: '1.7.0_75'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
... 14 more
Caused by: org.openqa.selenium.WebDriverException: java.lang.InterruptedException: Process timed out after waiting for 45000 ms.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'fa59fe32da9b', ip: '172.17.0.23', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-46-generic', java.version: '1.7.0_75'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.os.CommandLine.waitFor(CommandLine.java:131)
at org.openqa.selenium.firefox.FirefoxBinary.waitFor(FirefoxBinary.java:222)
at org.openqa.selenium.firefox.FirefoxBinary.clean(FirefoxBinary.java:242)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:91)
... 19 more
Caused by: java.lang.InterruptedException: Process timed out after waiting for 45000 ms.
at org.openqa.selenium.os.UnixProcess.waitFor(UnixProcess.java:148)
at org.openqa.selenium.os.CommandLine.waitFor(CommandLine.java:129)
... 22 more
20:01:59.423 WARN - Exception: Process timed out after waiting for 45000 ms.
20:01:59.505 INFO - Executing: [new session: Capabilities [{firefox_profile=UEsDBBQAAAAIAD1oeEZh7yP8ZwMAA..., platform=ANY, javascriptEnabled=true, browserName=firefox, proxy={httpProxy=172.28.128.11:9923, sslProxy=172.28.128.11:9923, proxyType=MANUAL}, version=}]])
20:01:59.509 INFO - Creating a new session for Capabilities [{firefox_profile=UEsDBBQAAAAIAD1oeEZh7yP8ZwMAA..., platform=ANY, javascriptEnabled=true, browserName=firefox, proxy={httpProxy=172.28.128.11:9923, sslProxy=172.28.128.11:9923, proxyType=MANUAL}, version=}]
el.value = null
, where el
is an <input type=file>
element, is a legal action in content JavaScript. The clearElements
atom should be allowed to be used to clear the value.
This would involve changing the definition of isEditable
, possibly removing it altogether, from https://github.com/SeleniumHQ/selenium/blob/master/javascript/atoms/action.js#L75.
Today i have upgraded selenium-webdriver from 2.43 to 2.45 its really slows down the test execution.
the test use to run in 3 min 20 seconds now taking 5 minutes to run.
after switching to the old driver again test run time went back to original.
Reproduced with Selenium 2.45
HUB: Linux, Ubuntu
Node: Windows 8, Chrome
Steps to reproduce:
1) Start Selenium Grid. Let say, only 2 stations: HUB and NODE.
For HUB, set timeouts, as:
"timeout": 20000
"browserTimeout": 20000
For NODE do not set any timeouts explicitly.
2) Run this code against Grid:
driver.get(url);
sleep(30000);
driver.get(url);
It fails with org.openqa.selenium.remote.SessionNotFoundException
.
This line added to the NODE log:
INFO org.openqa.selenium.remote.server.DriverServlet - Session 7f5fffec-4882-4c4c-b091-c780c66d379d deleted due to client timeout
3) So, trying to resolve issue, increase timeouts on the HUB:
"timeout": 40000
"browserTimeout": 40000
Restart HUB. NODE would re-register automatically.
Defect:
Code still fails. Timeout still set at 20 seconds. But, if you look at the Grid console, it would show new (updated) configuration, which is misleading.
The reason: NODE haven't read new timeouts from the HUB.
NODE will only read that new configuration, when re-started.
Expected:
NODE would read configuration from the HUB, when re-registering.
Hi!
The current implementation of the SelectedOption property is quite slow (because it checks each element in turn). Because of this a colleague of mine implemented an extension method which (he claims). The replacement code is simply as such:
return _element.FindElement(By.CssSelector("option[selected]"))
AllSelectedOptions could be adapted in a similar manner (i.e. FindElements with same selector).
Let me know if that solution actually works or if its just a "common special case" kind of thing.
Cheers!
Attempts to start the driver with self.driver = webdriver.Firefox() fails with
ERROR:root:Message: "Can't load the profile. Profile Dir: c:\\users\\martin~1\\appdata\\local\\temp\\tmpldmwnd Firefox output: None"
Traceback (most recent call last):
File "C:\Python\SeaMonsters\test\acceptance\__init__.py", line 63, in setUp
self.driver = webdriver.Firefox()
File "C:\Python\SeaMonsters\env\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in __init__
self.binary, timeout),
File "C:\Python\SeaMonsters\env\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "C:\Python\SeaMonsters\env\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 64, in launch_browser
self._wait_until_connectable()
File "C:\Python\SeaMonsters\env\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 108, in _wait_until_connectable
self.profile.path, self._get_firefox_output()))
Selenium 2.45.0 uses synthetic keyboard events for Firefox 36.0.4 on all(?) platforms. These synthetic keyboard events set the javascript KeyboardEvent.key property always to 'Unidentified' instead of the expected character.
Using native events with Firefox <= 34.0.5 on Windows 7 the following phpunit test run successfully:
<?php
class KeyTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser('firefox');
$this->setHost('localhost');
$this->setBrowserUrl('http://unixpapa.com/js/testkey.html');
}
public function testKeys()
{
$this->url('http://unixpapa.com/js/testkey.html');
$this->byName('classic')->click();
$this->byName('dom3')->click();
$this->keys('z');
$this->assertContains('key=z', $this->byTag('textarea')->value());
}
}
As far as I can see, it's related to the use of sendKeyEvent
in favour to sendNativeKeyEvent
in
While testing sendNativeKeyEvent
in Firefox's Scratchpad I had mixed results:
Hi Folks,
I am trying to open one of my heavy web application using selenium, and facing considerable performance issue.
when i am opening the same application without selenium it works very very fast, not sure why such issue, (please note i am new to this community, i might be missing something here)
I am also forcing browser to cache the contents, but looking into fiddler contents are also not getting cached.. have spent now a complete day with no satisfaction.. please help
PS : Do we have any active community forum where we get answers from active users.
static NewInternetExplorerDriver driver;
@BeforeClass
public static void launchDriver(){
System.setProperty("webdriver.ie.driver","IEDriverServer32.exe");
//System.setProperty("webdriver.chrome.driver", "chromedriver32.exe");
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
cap.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, false);
cap.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, false);
cap.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true);
Capabilities cap1 = (Capabilities) cap;
driver = new NewInternetExplorerDriver(cap1);
//driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(60,TimeUnit.SECONDS);
}
@Test
public void Step1_LaunchApplication() throws InterruptedException {
driver.get("http://server23:8086/home");
System.out.println("Loading Completed");
Thread.sleep(2000);
}
Python 2.7 (Selenium 2.45 package)
Ubuntu 14.04 Selenium Grid 2.45
I am currently running into an issue where I am unable to pass chrome options to the grid correctly. It appears to be due to a java casting error. It matches correctly but then cannot cast chrome options, even if left as an empty string. Other capabilities work fine though, and it works correctly if I remove chrome options.
Hub stacktrace:
12:47:46.784 INFO - Got a request to create a new session: Capabilities [{platform=ANY, javascriptEnabled=true, browserName=chrome, chromeOptions={args=[--use-fake-device-for-media-stream, --disable-user-media-security=true], extensions=[]}, version=}]
12:47:46.784 INFO - Available nodes: [host :http://172.17.42.1:5555]
12:47:46.784 INFO - Trying to create a new session on node host :http://172.17.42.1:5555
12:47:46.784 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, platform=LINUX, chrome_binary=/usr/bin/google-chrome, browserName=chrome, maxInstances=8, version=41}
12:47:46.785 ERROR - Error running the beforeSessionListener : java.util.HashMap cannot be cast to com.google.gson.JsonObject
java.lang.ClassCastException: java.util.HashMap cannot be cast to com.google.gson.JsonObject
at org.openqa.grid.selenium.proxy.DefaultRemoteProxy.beforeSession(DefaultRemoteProxy.java:238)
at org.openqa.grid.web.servlet.handler.RequestHandler.beforeSessionEvent(RequestHandler.java:169)
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:110)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:745)
Python Stacktrace:
WebDriverException: Message: Error forwarding the new session The listener threw an exception ( listener bug )
Stacktrace:
at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:114)
at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle (ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle (ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle (SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle (ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope (ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope (SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope (ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle (ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle (HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle (Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest (AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest (BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content (AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content (AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext (HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable (HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle (BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run (SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run (QueuedThreadPool.java:534)
at java.lang.Thread.run (Thread.java:745)
Details of the setup used to test this:
Windows 7
ChromeDriver (chrome ver 41)
Java bindings, selenium version 2.44.0
Java and html+js code to reproduce the issue: https://gist.github.com/anonymous/c81bb74d9bbcd94b0398
What should happen: The test should pass as the div with id 'woop' is being removed via assigning the innerHTML.
What happens: The wait times out after waiting for the ExpectedConditions specified (for the element with id 'woop' to not be present).
You can see the same behaviour with visibilityOfElementLocated and using ExpectedConditions.not - here it's even more obvious that this is broken as using invisibilityOfElementLocated works just fine where using ExpectedConditions.not(ExpectedConditions.visibilityOfElementLocated) doesn't.
I installed the latest server and client/webdriver today and now I am not able to use Selenium IDE. I get the following error message -
"Table view is not available with this format" I am not able to use Selenium IDE at all.
Scenario: After uploading an invalid file (apart from image file) using AutoIt, pop up is not displaying. Uploading a proper file (any image file) works fine
Browser: Firefox 34.0.5
Selenium Library Version: selenium-server-standalone-2.42.2
Autoit: autoit-v3
Steps:
My Code is as below
public static WebDriver openfirefox;
@test(priority = 1)
public void openLink() {
openfirefox.get(https://www.psprint.com/);//Opens the URL
openfirefox.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);// Wait
}
@test(priority = 2)
public void upload() throws InterruptedException {
if(isElementPresent(By.id("fileupload_front1"))) {
upload("front");
}
}
private void upload(String side) {
WebElement error = openfirefox.findElement(By.xpath(Constant.CloseError));
if(side == "front"){
openfirefox.findElement(By.id("fileupload_front1")).click();// Clicks on Upload now button
Runtime.getRuntime().exec(Constant.UploadPath);
openfirefox.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
if(error.isDisplayed()) {
openfirefox.findElement(By.xpath(CloseError)).click();//Close the error window
}
}
There is actually an existing bug report (https://code.google.com/p/selenium/issues/detail?id=3804), but I did not know if anybody would notice my reply there.
Summary:
IWebDriver Driver = new FirefoxDriver();
does not work for Mono, as the DotNetZip library (https://dotnetzip.codeplex.com/) is not platform independent and uses backslashes instead of Path.DirectorySeperator. This results in an exception:
System.ArgumentException: Path is empty
at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
at Ionic.Zip.ZipEntry.InternalExtract (System.String baseDir, System.IO.Stream outstream, System.String password) [0x00000] in <filename unknown>:0
Actually, there is already a patch created by user moonverma, which should fix this issue (https://www.codeplex.com/Download?ProjectName=dotnetzip&DownloadId=905384). Unfortunately, it does not seem that there will be any new release soon (last update: 2011, and a bunch of open patches and issues).
To make a long story short, have you ever thought of providing a patched version of DotNetZip to enable FirefoxDriver in Mono?
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.