-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WebDriver Capability APIs to support launching browsers in "Responsive Design Mode" #6746
Comments
@gwtuser How do those browsers activate that mode? Is it via a profile setting? Is it via a command-line switch on the browser executable? Is it only done via some browser chrome or the developer tools? |
From my understanding, responsive mode can be entered via a hotkey sequence or interaction with "browser chrome" in the developer tools, and then the target device must be selected via a "browser chrome" picker that appears on the original page (outside the page's HTML). |
I would like to add a bit more to this thread: While using Webdriver.io, adding this capability to emulate iPhone 6 in Chrome (latest) is working:
However, adding this capability to emulate iPhone 6 in Firefox (latest) is not working:
I've tried passing |
For ChromeDriver there is a good starting point documented here. For GeckoDriver I could not find any documentation related to this, if someone is interested, please reach out to the https://github.com/mozilla/geckodriver project. As mentioned in a previous comment, most of this is already possible through browser preferences, which is normally out of the scope of this project. This type of built-in features are better placed in a framework built on top of Selenium. |
馃殌 Feature Proposal
Firefox and Chrome now have "responsive design" mode, which allows them to emulate specific handheld devices such as the iPhone. This is more than just using a specific screen size, as it involves touch and user agent emulation. Basically, the browser closely emulates how it would run on the selected device.
Motivation
This would allow cross-platform testing using a single test harness. Specifically, it would allow automation of tests that target mobile platforms. I've not had much luck sending key sequences to attempt to toggle Responsive Design Mode, and even if it worked, I'd have no way of selecting the device, as Selenium can't manipulate the "chrome" widgets that determine the device - browser controls outside the HTML.
Example
Some pseudocode for using the new APIs might be:
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capability.setResponsiveDesignPlatform(Platform.IPhone);
driver = new FirefoxDriver(capabilities);
Then, driver.get() would open the browser in responsive design mode.
The text was updated successfully, but these errors were encountered: