[![enter image description here][1]][1]When I launch a test case in Chrome headless it fails because it can't find a button, but when I launch it in Chrome visible it succeeds. Why?
Try to take a screenshot and validate, that the element you want to click is visible. Perhaps your screen is with to small size.
Because Chrome headless doesn't perform integrated authentication. At least by default.
Related
I have the following screen
And this is my ruby steps for clicking the "STATUS" tab.
And(/^Click The Status Tab$/) do
# statusTab = driver.link(id: "tab3")
statusTab = driver.link visible_text: "STATUS"
statusTab.wait_until_present
if statusTab.exists?
statusTab.click
puts "Status Tab Clicked"
else
fail "Could NOT locate Status Tab"
end
end
As you can see in my code above, I have tried using the locator "link" by 'id' and 'visible_text'.
The code above works fine in my local computer. I have tried running it using chromedriver and chromedriver in headless mode. I have tried using Jenkins in my local computer, too.
But, it failed when running it in Jenkins server in the AWS.
I got the following error in my cucumber report:
unknown error: Element <em>...</em> is not clickable at point (146, 16). Other element would receive the click: <li>...</li>
(Session info: headless chrome=62.0.3202.62)
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.4.0-1039-aws x86_64) (Selenium::WebDriver::Error::UnknownError)
Is there a way to tackle this issue?
Most of the time that something works in a real browser, but not headless is due to a difference in the size of the actual browser window. Headless seems to open in a smaller window, which can cause two things to happen
1) element may be off-screen and can't be scrolled to for some reason
2) (especially typical of reactive sites that arrange to fit space allowed) the site ends up arranged such that another element is covering the one you are trying to click.
The clue to which is the case is usually in the error message. In your case the text Other element would receive the click is telling you that something else has covered up the thing you are trying to click on.
Try setting the browser window size right after you create your browser/driver object. If you are using Watir the command usually looks something like this
browser.window.resize_to(1024, 768)
Generally I talk to the PO and ask what the minimum supported screen size (assuming a maximized browser window) is, and set the browser to that size. Often if tablet browsing is to be supported without a special mobile site, the smallest supported screen size will beo 1024x786 or 768x1024 (depending if portrait or landscape orientation is assumed)
I have a simple set of HTML and JS which when I test it directly as a web page, loaded locally from the file system in Chrome, works fine. I can click a button causing a call to navigator.bluetooth.requestDevice. This correctly causes the usual window to appear and it lists the expected Bluetooth peripheral. I can then select it and successfully pair, with my code receiving the expected callback.
If I try to execute the same html/js as a Chrome app, with a manifest and invoked from chrome://extensions the requestDevice window appears and lists the expected peripheral with the Pair button disabled. If I select the peripheral, the Pair button becomes enabled but if I click it, the window disappears into the background, behind Chrome and nothing else happens that I can see. My code receives no callback. It looks like the call was competely ignored.
What do I need to do to make this work within a Chrome app?
Thanks
Chrome Apps and Extensions should be able to use Web Bluetooth. This is a bug. I've filed chromium issue 751819.
As a work around, create the Chrome App window larger than the device chooser dialog that pops up.
I'm running some tests in Watir/Cucumber (Ruby) and when the test executes and the browser window opens the text size causes the page to only take up about 1/4 of browser window. This only happens with Firefox and when I'm displaying through my laptop which is a MBP with retina display; not my secondary monitor.
Any advice would be awesome!
use this code to maximize firefox , won't maximize chrome though
page.driver.browser.manage.window.maximize
hope this will work for you.
Will help you
#browser.window.maximize
I am testing the action of opening a PDF. In firefox I do not get a popup, but in selenium I get a save popup window. Is there a say to record this locator? or some other approach for selenium to click on that popup which only appears in Safari. I'm using Safari browser 5.0.5. Thanks!
I need to test web application that extensively uses geo location api (getCurrentPosition, watchPosition). Is there any browser (Chrome, Firefox) plugin that allows to simulate geo location?
I am a bit late, but Microsoft Edge has this useful tab Emulation.
You can open this developer tool as usual hitting F12 button or by clicking on the browser's menu button, Developer Tools F12.
Geolocation:
Simulate a GPS receiver and enter GPS coordinates to test location-aware features in a webpage.
More info here at developer.microsoft.com
If I understood the question correctly and you're asking for a way to fake geolocation responses for your web app, you might be able to do this in Firefox by overriding the geo.wifi.uri in the prefs, like Firefox's unit tests do. See:
http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/geolocation_common.js?force=1
http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/network_geolocation.sjs?force=1 - the httpd.js script responding to requests of the geo.wifi.uri used in the tests.
Chromium 52 has it in-built:
Open developer console
Click the : button on the right, select More tools -> Sensors
In Tab "Sensors" you can modify the current location: