I am trying to inspect the page during an integration test, and so I have a test which I added a breakpoint in-- Once chrome launches and the test begins, the breakpoint hits, and the browser is idle.. As soon as I open the web inspector, chrome quits with the error:
Selenium::WebDriver::Error::WebDriverError:
disconnected: received Inspector.detached event
I am using Chrome version 37.0.2062.124, and ChromeDriver version 2.10.267517
This is intended. This is because the ChromeDriver uses the DevTools API to interact with Chrome.
The DevTools within Chrome has one major disadvantage and that is it only allows one debugger (whatever that might be, whether it's you or the driver itself) attached to it. Thus, once you open it, ChromeDriver cannot use it.
This is a limitation of Chrome -> the best you can do is get your test to a point where it fails, have your test close it's session but leave the browser open. Thus you have quit your test but effectively left your browser in the state of which the test failed.
This is about chrome issue(https://bugs.chromium.org/p/chromedriver/issues/detail?id=1194).
When you are running selenium program, you cannot press F12 to open dev tools manually, or it'll throw this exception sometimes.
According to the issue list, it looks like fixed, but I still meet this bug in ChromeDriver 2.29
The same problem you can visit.
Related
I am not able to figure out why selenium API's are not executing in chrome browser, while chromedriver and chrome version is identical.
Chromedriver Version -> 91.0.4472.19
Chrome Version-> 91.0.4472.124
Output: Chrome launches and "data;" comes written in URL Bar. Nothing happens after that and test continues in running state.
I have tested with chromedriver 89,90,91,92. But nothing seems to be working.
Have anyone faced this issue ever where chrome and chromdriver version were same but browser is not executing selenoum API?
Code:
Browser name is passed from testngXML file.
ChromeOptions options = new ChromeOptions ();
options.setBinary("C\\ProgramFiles(86)\\..\\chrome.exe"); (in this location, I have chrome 91)
.......
......
System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\chromedriver.exe"); (Here I have chromedriver 91)
This issue was related to somehow chrome policies. In my corporate system, there was a policy adding in chrome browser from admin (In every 1 hour) which was marking "disableChromeDevToolBar" as true. This was making the inspect (ctrl+shift+I) also greyed out.
I tried to fix this part, by changing the "disableChromeDveToolBar" value from 1 to 0 ([Windor+r-> regedit-> HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]).
This made the inspect and selenium API execution working in the chrome browser.
Note: I did not do any change in chrome browser and chromedriver. Issue was purely because of this policy.
Trying to get that policy detail from support team, if I can find out, I will update here.
Safari Driver closes the browser after automated test case have run but Safari browser instance hangs and I can still see it in the open apps. Any suggestion ? At the moment I am using the following snippet to shut the browser sessions (it works for chrome). Safari Version 11.0.3 (13604.5.6). Selenium 3.11. java version "1.8.0_171".
if (System.getProperty("browser").equals("chrome") || System.getProperty("browser").equals("safari")) {
driver.quit();
}
Your mileage may vary, but I had a similar issue and found a thread here: https://github.com/appium/appium/issues/9938 where the solution (with Appium at least and also woking in my current Selenium proj) is to wait before trying to quit the driver.
When I execute tests using MicrosoftWebDriver for Edge all works fine, but when I minimise the window all tests become failed. Does Edge or MicrosoftWebDriver have any options to avoid that behavior?
As you have been trying to minimise the Browser Window while your Test Execution is In Progress it will be against all the Best Practices. At this point it is worth to mention that as Selenium mocks the User Actions hence Selenium needs Browser focus. If the focus is lost Selenium won't be able to execute the lines of code. Consider the following steps while your Test Execution :
Browser Maximize : While you execute your tests always keep the Web Browser maximized so majority of the elements are within the Viewport
As per best practices, you should try to execute your Test Scripts / Automation Framework in an isolated Test Environment away from Manual Intervention with all the required Software and Hardware configurations and setup.
You can find a detailed discussion in How to run chrome driver in background using selenium with Ruby for Mac OSx?
You also have an option to use Google Chrome or Mozilla Firefox in Headless version.
For Firefox you can find a detailed discussion in How to make firefox headless programatically in Selenium with python?
For Chrome you can find a detailed discussion in selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
For Ghost Browser you can find a detailed discussion in Which drivers support “no-browser”/“headless” testing?
I have a local selenium server (2.42.2) running with Chromedriver and Firefox. It seems to get stuck after loading and running client.html. I can see that my functional suite code runs in node, far enough to execute the main body. Anything in registerSuite never gets called.
Here are the selenium logs:
http://pastebin.com/KKg5ycvW
I can see the browsers in the selenium sessions page, but they don't appear to be doing anything.
Try opening up a new browser window and paste in the url that you see in the existing selenium ones. Then open up dev tools and see what console errors you are getting.
Intern's runner seems to get stuck in an infinite loop if any uncaught javascript errors are thrown during unit tests if the 'reporter' hasn't been setup yet.
This has been raised as an issue in intern's github repository.
I want to run my Geb specs with chrome driver without having to watch the tests on the browser? can this be done?
P.D.: I know I can use the HtmlUnitDriver, but this driver sometimes gives my errors (caused mainly by timeouts) that the chrome driver don't.
There is currently no way to do this with Chrome, Safari, Opera or FireFox, however there are multiple options you can do. First is to pipe the "window" into a virtual frame buffer (if you're using Linux). This process will pop open the browser, only in memory. I talk about this in my blog post (http://www.ensor.cc/2011/05/maven-javascript-unit-test-using.html) during the maven pre-integration phase
The other option is to use the brand new GhostDriver. GhostDriver is a WebDriver implementation of PhantomJS which is a headless WebKit. This is WAY better than HtmlUnit but still has some features being built out. GhostDriver is currently not in Maven Central, so you will need to manually add it to the common repository. You can then use it as a WebDriver. This has worked for me with moderate success (90% of my test cases dropped in without any changes needed).
Read this first: http://blog.ivandemarino.me/2012/12/04/Finally-GhostDriver-1-0-0
Then refer to the GitHub README and code: https://github.com/detro/ghostdriver