Skip to content

Instantly share code, notes, and snippets.

@ptcmariano
Created April 8, 2015 11:44
Show Gist options
  • Save ptcmariano/b13da23127593fb51287 to your computer and use it in GitHub Desktop.
Save ptcmariano/b13da23127593fb51287 to your computer and use it in GitHub Desktop.
EmulationMobileChrome.java
//http://testeimporta.blogspot.com.br/2015/04/referencia-de-emulacao-do-chrome-no.html
//imports
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import javax.swing.*;
import java.util.HashMap;
import java.util.Map;
//metodo de teste
@Test
public void testEmulation(){
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", "Samsung Galaxy Tab");
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
driver.navigate().to("http://www.google.com.br/");
JOptionPane.showMessageDialog(null, "emule");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment