In my Ruby on Rails 6.0, I'm trying to test a page that has access to the camera.
The problem is that when I visit this page, there is a popup message that I should permit to use the camera.
This is breaking my tests, how can I click allow to that popup or somehow give permissions to the camera to Selenium WebDrvier.
Thanks in advance
Related
While attempting to test scripts using either cy.viewport('iphone-x') or cy.viewport(375,812), both render the site the same (incorrectly) but differently than if I open Chrome, go to devtools and specify the same device there. I'm relatively new to Cypress but I haven't been able to figure out why this happens or how to get Cypress to render the website correctly.
Using Devtools
Using Cypress
So it looks like this might actually be a code issue within the app. Using devtools, if I inspect the white space it shows height:auto. De-selecting this within devtools makes the screen look like it does when viewing it in Cypress using a mobile viewport. I've logged a bug with my app's development team.
I am using watir web driver for web automation testing. I have to handle the popup window dynamically which is without title. This popup will display at any case. so i need to handle globally. Can anyone help me to solve this issue.
If something like that shows up intermittently, I would (assuming you're using cucumber) make a page object for the pop up, and use it in an AfterStep hook.
Something like this
AfterStep do
pop_up = PopUpPageObject.new(self)
pop_up.close if pop_up.present
end
I try to get a resized 400x400 screenshot of google. I try this both in Selenium and Watir with no success.
require 'watir-webdriver'
b = Watir::Browser.new
b.goto 'google.com'
b.window.resize_to(400,400)
b.driver.save_screenshot("screenshot.jpg")
I always get the screenshot with the original browser size.
Any idea how can I save it resized to 400x400?
At present, WebDriver defines a screenshot as a "full page screenshot". That is, the entire DOM should be represented by the image generated by the save_screenshot method. The fact that the Chrome driver doesn't generate a screenshot of the full DOM is a bug in the Chrome driver. So the real answer is that there is no way to generate a screenshot of only the browser view port using WebDriver.
Having said that, it might be possible to use other programmatic means to accomplish this, depending on your OS. On Windows, for example, it would be pretty easy to get the desktop window's window handle (HWND), capture the image of the desktop (using the Windows GetDesktop and PrintWindow APIs), and cropping it using the coordinates supplied by the WebDriver Window API.
I was able to reproduce the problem with Firefox, but Chrome generates resized screenshot. My guess is that it is a bug in FirefoxDriver. Take a look if the problem is already reported in Selenium bug tracker and if not, report it.
I have to click on a jquery dropdown with selenium. Found that
MouseUp[xpath=//a[contains(text(),'itemname')]
works in IDE. But am at loss, as I cannot simulate this in ruby webdriver. Is it possible to simulate it with actions class? If so how? Kindly help me out.
Check out the Filling out forms part on the Selenium WebDriver Docs http://seleniumhq.org/docs/03_webdriver.jsp#user-input-filling-in-forms
This should lead you in the right direction for your problem.
I want to capture a webpage as an image. I am able to do this using a firefox extension using context.drawWindow method. Now I want to strech myself and see if I can do this using a bookmarklet :)
I remember reading somewhere that context.drawWindow() works only from the firefox toolbars. I dont know if that's still true or not.
Can anyone shed some light if I can execute context.drawWindow() from a bookmarklet or no?
Thanks
Kapil
You can't, since bookmarklets run with the permissions of the page, and drawWindow is chrome-only (can only be used by Firefox UI and extensions, not Web pages).