@SuppressWarnings("serial")
@Test
public void setUserAgentOverrideTest() {
// Arrange
baseURL = "https://www.whoishostingthis.com/tools/user-agent/";
driver.get(baseURL);
By locator = By.cssSelector("div.info-box.user-agent");
WebElement element = driver.findElement(locator);
assertThat(element.getAttribute("innerText"), containsString("Mozilla"));
// Act
try {
driver.executeCdpCommand("Network.setUserAgentOverride", new HashMap<String, Object>() {
{
put("userAgent", "python 2.7");
put("platform", "Windows");
}
});
} catch (WebDriverException e) {
System.err.println("Exception (ignored): " + e.toString());
// org.openqa.selenium.WebDriverException: unknown error: unhandled
// inspector error :
// {"code":-32601,"message":"'setUserAgentOverride'
// wasn't found"}
}
driver.navigate().refresh();
sleep(1000);
element = driver.findElement(locator);
assertThat(element.isDisplayed(), is(true));
assertThat(element.getAttribute("innerText"), is("python 2.7"));
}
@Bean
public JasperReportsViewResolver getJasperReportsViewResolver() {
JasperReportsViewResolver resolver = new JasperReportsViewResolver();
resolver.setPrefix("classpath:jasperreports/");
resolver.setSuffix(".jrxml");
resolver.setReportDataKey("datasource");
resolver.setViewNames("*rpt_*");
resolver.setViewClass(JasperReportsMultiFormatView.class);
resolver.setOrder(0);
return resolver;
}
<dependencies>
<dependency>
<groupId>org.omegat</groupId>
<artifactId>jmyspell-core</artifactId>
<version>1.0.0-beta-2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>omegat</id>
<name>OmegaT Repository</name>
<url>https://dl.bintray.com/omegat-org/maven/</url>
</repository>
</repositories>
$ ls ~/.m2/repository/org/omegat/jmyspell-core/1.0.0-beta-2/
_remote.repositories
jmyspell-core-1.0.0-beta-2.jar
jmyspell-core-1.0.0-beta-2.jar.lastUpdated
jmyspell-core-1.0.0-beta-2.jar.sha1
jmyspell-core-1.0.0-beta-2.pom
jmyspell-core-1.0.0-beta-2.pom.lastUpdated
jmyspell-core-1.0.0-beta-2.pom.sha1
$shared_assemblies = @(
'WebDriver.dll',
'WebDriver.Support.dll',
'nunit.core.dll',
'nunit.framework.dll'
)
$shared_assemblies_path = 'c:\csharp\sharedassemblies'
pushd $shared_assemblies_path
$shared_assemblies | ForEach-Object {
if ($host.Version.Major -gt 2) {
Unblock-File -Path $_
}
write-debug $_
Add-Type -Path $_
}
popd