• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JBrowserDriver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.machinepublishers.jbrowserdriver.JBrowserDriver的典型用法代码示例。如果您正苦于以下问题:Java JBrowserDriver类的具体用法?Java JBrowserDriver怎么用?Java JBrowserDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JBrowserDriver类属于com.machinepublishers.jbrowserdriver包,在下文中一共展示了JBrowserDriver类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: Adidas

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
public Adidas(ProxyObject proxy, CredentialObject credentials, String url, boolean splash, boolean manual, double[] sizes) {
	super();
    Builder builder = Settings.builder();
    
    if(proxy != null) {
	    builder.proxy(new ProxyConfig(Type.HTTP, proxy.getAddress(), proxy.getPort()));
    	//String server = proxy.getAddress() + ":" + proxy.getPort();
        //capability.setCapability(CapabilityType.PROXY, new Proxy().setHttpProxy(server).setFtpProxy(server).setSslProxy(server));
    }
    
    builder.logsMax(0);
    builder.loggerLevel(Level.OFF);
    builder.userAgent(UserAgent.CHROME);
       
	driver = new JBrowserDriver(builder.build());
	driver.manage().timeouts().setScriptTimeout(30L, TimeUnit.SECONDS);
	driver.manage().timeouts().pageLoadTimeout(30L, TimeUnit.SECONDS);
	
	this.proxy = proxy;
	this.url = url;
	this.splash = splash;
	this.manual = manual;
	this.sizes = sizes;
	carted = false;
}
 
开发者ID:Penor,项目名称:SneakerBot,代码行数:26,代码来源:Adidas.java


示例2: typeText

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
public static boolean typeText(Browser browser, WebElement element, String text, boolean validate, boolean newline) {
  String elementVal = null;
  if (validate) {
    elementVal = element.getAttribute("value");
  }
  if (!validate || !text.equalsIgnoreCase(elementVal)) {
    BrowserUtil.click(browser, element, false);
    if (validate) {
      element.clear();
    }
    if (!validate || !CommonUtil.isEmpty(element.getAttribute("value"))) {
      element.sendKeys(JBrowserDriver.KEYBOARD_DELETE);
    }
    element.sendKeys(text);
    browser.getKeyboard().sendKeys("\t");
    if (newline) {
      element.sendKeys("\n");
      browser.getStatusCode();
    }
    return true;
  }
  return false;
}
 
开发者ID:MachinePublishers,项目名称:ScreenSlicer,代码行数:24,代码来源:QueryCommon.java


示例3: before

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
@GwtIncompatible
@Before
public void before() {
	// for correct stacktrace decoding, we need the debug info.
	boolean debug = true;

	// Convert to javascript
	VertxUI.with(this.getClass(), null, debug, true);

	// Start the headless browser
	jBrowser = new JBrowserDriver(Settings.builder().logJavascript(true).build());
	jBrowser.get("file:///" + new File(VertxUI.getTargetFolder(debug) + "/index.html").getAbsolutePath());
}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:14,代码来源:TestDOM.java


示例4: getDriver

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
@Override
protected WebDriver getDriver() throws Exception
{
    Capabilities capabilities = Settings.builder()
            .headless(false)
            .saveAttachments(true)
            .screen(new Dimension(1200, 700))
            .ssl("trustanything")
            .timezone(Timezone.ASIA_TOKYO)
            .buildCapabilities();
    return new JBrowserDriver(capabilities);
}
 
开发者ID:hiroshitoda,项目名称:WebDriverBenchmark,代码行数:13,代码来源:JBrowserDriverBenchmarkTest.java


示例5: runJava

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
private CompletableFuture<?> runJava(String javaSource) {
    return MoreFutures.submitAsync(new Callable</*@Nullable*/ Void>() {
        @Override
        public @Nullable Void call() throws Exception {
            Class<?> syntheticUserTestClass = Compilations.compile(javaSource);
            // validation for default constructor and test method occurs on save
            Constructor<?> defaultConstructor = syntheticUserTestClass.getConstructor();
            Method method = syntheticUserTestClass.getMethod("test", WebDriver.class);
            Settings.Builder settings = Settings.builder()
                    .requestHeaders(REQUEST_HEADERS)
                    .userAgent(userAgent);
            HttpProxyConfig httpProxyConfig = configRepository.getHttpProxyConfig();
            if (!httpProxyConfig.host().isEmpty()) {
                int proxyPort = MoreObjects.firstNonNull(httpProxyConfig.port(), 80);
                settings.proxy(new ProxyConfig(ProxyConfig.Type.HTTP, httpProxyConfig.host(),
                        proxyPort, httpProxyConfig.username(), httpProxyConfig.password()));
            }
            JBrowserDriver driver = new JBrowserDriver(settings.build());
            try {
                method.invoke(defaultConstructor.newInstance(), driver);
            } finally {
                driver.quit();
            }
            return null;
        }
    }, syntheticUserTestExecutor);
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:28,代码来源:SyntheticMonitorService.java


示例6: shouldAddErrorEntryInstrumentation

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
@Test
public void shouldAddErrorEntryInstrumentation() throws Exception {
    // given
    App app = app();
    GlobalNavbar globalNavbar = globalNavbar();
    ConfigSidebar configSidebar = new ConfigSidebar(driver);

    app.open();
    globalNavbar.getConfigLink().click();
    configSidebar.getInstrumentationLink().click();

    // when
    createTraceEntryInstrumentation();

    // then
    app.open();
    globalNavbar.getConfigLink().click();
    configSidebar.getInstrumentationLink().click();
    Utils.withWait(driver, partialLinkText("org.glowroot.agent.it.harness.Container")).click();
    InstrumentationConfigPage configPage = new InstrumentationConfigPage(driver);
    assertThat(configPage.getClassNameTextField().getAttribute("value"))
            .isEqualTo("org.glowroot.agent.it.harness.Container");
    assertThat(configPage.getMethodNameTextField().getAttribute("value")).isEqualTo("execute");
    assertThat(configPage.getCaptureKindTraceEntryRadioButton().isSelected()).isTrue();
    assertThat(configPage.getTimerNameTextField().getAttribute("value")).isEqualTo("a timer");
    assertThat(configPage.getTraceEntryMessageTemplateTextField().getAttribute("value"))
            .isEqualTo("a trace entry");
    if (driver instanceof JBrowserDriver) {
        // just a little workaround
        assertThat(configPage.getTraceEntryStackThresholdTextField().getAttribute("value"))
                .isNull();
    } else {
        assertThat(configPage.getTraceEntryStackThresholdTextField().getAttribute("value"))
                .isEqualTo("");
    }
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:37,代码来源:InstrumentationConfigIT.java


示例7: login

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
private void login(GlobalNavbar globalNavbar, String username, String password)
        throws InterruptedException {
    globalNavbar.getSignInLink().click();
    sendKeys(globalNavbar.getLoginUsernameTextField(), username);
    sendKeys(globalNavbar.getLoginPasswordTextField(), password);
    if (driver instanceof JBrowserDriver) {
        // previously tried waiting for button to be not(@disabled)
        // but that didn't resolve sporadic issue with login action never occurring
        // (and being left on login page, timing out waiting for "sign out" link below
        Thread.sleep(500);
    }
    globalNavbar.getLoginButton().click();
    // wait for sign out button to appear, means login success
    globalNavbar.getSignOutLink();
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:16,代码来源:LoginIT.java


示例8: shouldCheckJvmPages

import com.machinepublishers.jbrowserdriver.JBrowserDriver; //导入依赖的package包/类
@Test
public void shouldCheckJvmPages() throws Exception {
    App app = app();
    GlobalNavbar globalNavbar = globalNavbar();
    JvmSidebar jvmSidebar = new JvmSidebar(driver);

    app.open();
    globalNavbar.getJvmLink().click();
    // sleep for a second to give time for jvm gauges page to make 2 requests
    // (first to get gauge list and then to get gauge points for default selected gauges)
    Thread.sleep(1000);

    jvmSidebar.getEnvironmentLink().click();

    jvmSidebar.getThreadDumpLink().click();
    // jstack view is not accessible via jvm sidebar currently
    app.open("/jvm/jstack");

    jvmSidebar.getHeapDumpLink().click();
    if (!WebDriverSetup.useCentral) {
        // heap dump is somehow causing cassandra connection to be lost on travis-ci:
        //
        // com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for
        // query failed (tried: /127.0.0.1:9042
        // (com.datastax.driver.core.exceptions.ConnectionException: [/127.0.0.1] Write attempt
        // on defunct connection))
        Utils.withWait(driver, By.xpath("//button[normalize-space()='Heap dump']")).click();
        Utils.withWait(driver, By.xpath("//button[normalize-space()='Yes']")).click();
        String heapDumpFileName = Utils
                .withWait(driver,
                        By.xpath("//div[@ng-show='heapDumpResponse']//table//tr[1]/td[2]"))
                .getText();
        if (!new File(heapDumpFileName).delete()) {
            throw new IOException("Could not delete heap dump file: " + heapDumpFileName);
        }
    }
    Utils.withWait(driver, By.xpath("//button[normalize-space()='Check disk space']")).click();
    Utils.withWait(driver, By.xpath("//div[@ng-show='availableDiskSpaceBytes !== undefined']"));

    jvmSidebar.getHeapHistogramLink().click();

    jvmSidebar.getMBeanTreeLink().click();
    List<WebElement> elements = new WebDriverWait(driver, 30).until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.className("gt-mbean-unexpanded-content")));
    for (WebElement element : elements) {
        element.click();
    }
    // test the refresh of opened items
    driver.navigate().refresh();
    if (!(driver instanceof JBrowserDriver)) {
        // need to go back to top of page b/c sidebar links need to be viewable before they can
        // be clicked in chrome and safari drivers
        ((JavascriptExecutor) driver).executeScript("scroll(0, 0)");
    }

    // jvm capabilities is not accessible via config sidebar currently
    app.open("/jvm/capabilities");
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:59,代码来源:BasicSmokeIT.java



注:本文中的com.machinepublishers.jbrowserdriver.JBrowserDriver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Dataset类代码示例发布时间:2022-05-22
下一篇:
Java OnDismissCallback类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap