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

Java CommandInfo类代码示例

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

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



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

示例1: getProxyExecutor

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
public static HttpCommandExecutor getProxyExecutor(URL url, Properties prop) {

        prop = decrypt(prop);

        String proxyHost = prop.getProperty("proxyHost");
        int proxyPort = Integer.valueOf(prop.getProperty("proxyPort"));
        String proxyUserDomain = prop.getProperty("proxyUserDomain");
        String proxyUser = prop.getProperty("proxyUser");
        String proxyPassword = prop.getProperty("proxyPassword");

        HttpClientBuilder builder = HttpClientBuilder.create();
        HttpHost proxy = new HttpHost(proxyHost, proxyPort);
        CredentialsProvider credsProvider = new BasicCredentialsProvider();

        credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort),
                new NTCredentials(proxyUser, proxyPassword, getWorkstation(), proxyUserDomain));
        if (url.getUserInfo() != null && !url.getUserInfo().isEmpty()) {
            credsProvider.setCredentials(new AuthScope(url.getHost(), (url.getPort() > 0 ? url.getPort() : url.getDefaultPort())),
                    new UsernamePasswordCredentials(proxyUser, proxyPassword));
        }
        builder.setProxy(proxy);
        builder.setDefaultCredentialsProvider(credsProvider);
        HttpClient.Factory factory = new SimpleHttpClientFactory(builder);
        return new HttpCommandExecutor(new HashMap<String, CommandInfo>(), url, factory);

    }
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:27,代码来源:RemoteProxy.java


示例2: createWebDriver

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
public WebDriverEx createWebDriver(DriverService driverService,
                                      DesiredCapabilities desiredCapabilities,
                                      SiteConfig siteConfig,
                                      DriverConfig driverConfig) throws IOException {
    driverService.start();

    //自定义HttpClientFactory用于设置命令超时时间
    ApacheHttpClient.Factory httpClientFactory = createHttpClientFactory(siteConfig, driverConfig);
    HttpCommandExecutor httpCommandExecutor = new HttpCommandExecutor(
            ImmutableMap.<String, CommandInfo>of(), driverService.getUrl(), httpClientFactory);
    WebDriverEx webDriver = new WebDriverEx(httpCommandExecutor, desiredCapabilities);
    webDriver.setDriverService(driverService);
    webDriver.setCreatedTime(new Date());

    webDriver.manage().timeouts().implicitlyWait(driverConfig.getImplicitlyWait(), TimeUnit.MILLISECONDS);
    webDriver.manage().timeouts().pageLoadTimeout(driverConfig.getPageLoadTimeout(), TimeUnit.MILLISECONDS);
    webDriver.manage().timeouts().setScriptTimeout(driverConfig.getScriptTimeout(), TimeUnit.MILLISECONDS);

    return webDriver;
}
 
开发者ID:brucezee,项目名称:jspider,代码行数:21,代码来源:WebDriverFactory.java


示例3: AppiumCommandExecutor

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
public AppiumCommandExecutor(Map<String, CommandInfo> additionalCommands,
    URL addressOfRemoteServer, HttpClient.Factory httpClientFactory) {
    super(additionalCommands, addressOfRemoteServer, httpClientFactory);
    service = null;
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:6,代码来源:AppiumCommandExecutor.java


示例4: createCommandRepository

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
private static Map<String, CommandInfo> createCommandRepository() {
    HashMap<String, CommandInfo> result = new HashMap<String, CommandInfo>();
    result.put(RESET, postC("/session/:sessionId/appium/app/reset"));
    result.put(GET_STRINGS, postC("/session/:sessionId/appium/app/strings"));
    result.put(SET_VALUE, postC("/session/:sessionId/appium/element/:id/value"));
    result.put(PULL_FILE, postC("/session/:sessionId/appium/device/pull_file"));
    result.put(PULL_FOLDER, postC("/session/:sessionId/appium/device/pull_folder"));
    result.put(HIDE_KEYBOARD, postC("/session/:sessionId/appium/device/hide_keyboard"));
    result.put(RUN_APP_IN_BACKGROUND, postC("/session/:sessionId/appium/app/background"));
    result.put(PERFORM_TOUCH_ACTION, postC("/session/:sessionId/touch/perform"));
    result.put(PERFORM_MULTI_TOUCH, postC("/session/:sessionId/touch/multi/perform"));
    result.put(IS_APP_INSTALLED, postC("/session/:sessionId/appium/device/app_installed"));
    result.put(INSTALL_APP, postC("/session/:sessionId/appium/device/install_app"));
    result.put(REMOVE_APP, postC("/session/:sessionId/appium/device/remove_app"));
    result.put(LAUNCH_APP, postC("/session/:sessionId/appium/app/launch"));
    result.put(CLOSE_APP, postC("/session/:sessionId/appium/app/close"));
    result.put(LOCK, postC("/session/:sessionId/appium/device/lock"));
    result.put(COMPLEX_FIND, postC("/session/:sessionId/appium/app/complex_find"));
    result.put(GET_SETTINGS, getC("/session/:sessionId/appium/settings"));
    result.put(SET_SETTINGS, postC("/session/:sessionId/appium/settings"));
    result.put(GET_DEVICE_TIME, getC("/session/:sessionId/appium/device/system_time"));
    result.put(GET_SESSION,getC("/session/:sessionId/"));
    //iOS
    result.put(SHAKE, postC("/session/:sessionId/appium/device/shake"));
    //Android
    result.put(CURRENT_ACTIVITY,
        getC("/session/:sessionId/appium/device/current_activity"));
    result.put(END_TEST_COVERAGE,
        postC("/session/:sessionId/appium/app/end_test_coverage"));
    result.put(GET_NETWORK_CONNECTION, getC("/session/:sessionId/network_connection"));
    result.put(IS_LOCKED, postC("/session/:sessionId/appium/device/is_locked"));
    result.put(LONG_PRESS_KEY_CODE,
        postC("/session/:sessionId/appium/device/long_press_keycode"));
    result.put(OPEN_NOTIFICATIONS,
        postC("/session/:sessionId/appium/device/open_notifications"));
    result.put(PRESS_KEY_CODE,
        postC("/session/:sessionId/appium/device/press_keycode"));
    result.put(PUSH_FILE, postC("/session/:sessionId/appium/device/push_file"));
    result.put(SET_NETWORK_CONNECTION,
        postC("/session/:sessionId/network_connection"));
    result.put(START_ACTIVITY,
        postC("/session/:sessionId/appium/device/start_activity"));
    result.put(TOGGLE_LOCATION_SERVICES,
        postC("/session/:sessionId/appium/device/toggle_location_services"));
    result.put(UNLOCK, postC("/session/:sessionId/appium/device/unlock"));
    result.put(REPLACE_VALUE, postC("/session/:sessionId/appium/element/:id/replace_value"));
    return result;
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:49,代码来源:MobileCommand.java


示例5: createGridExecutor

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
/**
 * Returns an {@link URL} to a Selenium grid (e.g. SauceLabs) that contains basic authentication for access
 * 
 * @return {@link URL} to Selenium grid augmented with credentials
 * @throws MalformedURLException
 */
public static HttpCommandExecutor createGridExecutor(ProxyConfigurationDto proxyConfig, URL gridUrl, String gridUsername,
                                                     String gridPassword) throws MalformedURLException
{
    // create a configuration for accessing target site via proxy (if a proxy is defined)
    // the proxy and the destination site will have different or no credentials for accessing them
    // so we need to create different authentication scopes and link them with the credentials
    BasicCredentialsProvider basicCredentialsProvider = new BasicCredentialsProvider();

    // create credentials for proxy access
    if (proxyConfig != null //
    && !StringUtils.isEmpty(proxyConfig.getUsername()) //
    && !StringUtils.isEmpty(proxyConfig.getPassword()))
    {
        AuthScope proxyAuth = new AuthScope(proxyConfig.getHost(), Integer.valueOf(proxyConfig.getPort()));
        Credentials proxyCredentials = new UsernamePasswordCredentials(proxyConfig.getUsername(), proxyConfig.getPassword());
        basicCredentialsProvider.setCredentials(proxyAuth, proxyCredentials);
    }

    // create credentials for target website
    AuthScope gridAuth = new AuthScope(gridUrl.getHost(), gridUrl.getPort());

    if (!StringUtils.isEmpty(gridUsername))
    {
        Credentials gridCredentials = new UsernamePasswordCredentials(gridUsername, gridPassword);
        basicCredentialsProvider.setCredentials(gridAuth, gridCredentials);
    }

    // now create a http client, set the custom proxy and inject the credentials
    HttpClientBuilder clientBuilder = HttpClientBuilder.create();
    clientBuilder.setDefaultCredentialsProvider(basicCredentialsProvider);
    if (proxyConfig != null)
        clientBuilder.setProxy(new HttpHost(proxyConfig.getHost(), Integer.valueOf(proxyConfig.getPort())));
    CloseableHttpClient httpClient = clientBuilder.build();

    Map<String, CommandInfo> additionalCommands = new HashMap<String, CommandInfo>();   // just a dummy

    // this command executor will do the credential magic for us. both proxy and target site credentials
    return new HttpCommandExecutor(additionalCommands, gridUrl, new ProxyHttpClient(httpClient));

}
 
开发者ID:Xceptance,项目名称:SiteGenesis-Community-TestSuite,代码行数:47,代码来源:AnnotationRunnerHelper.java


示例6: seleniumSetup

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
/**
 * Connect to selenium.
 *
 * @throws MalformedURLException
 */
@Before(order = ORDER_10, value = {"@mobile,@web"})
public void seleniumSetup() throws MalformedURLException {
    String grid = System.getProperty("SELENIUM_GRID");
    if (grid == null) {
        fail("Selenium grid not available");
    }
    String b = ThreadProperty.get("browser");

    if ("".equals(b)) {
        fail("Non available browsers");
    }

    String browser = b.split("_")[0];
    String version = b.split("_")[1];
    commonspec.setBrowserName(browser);
    commonspec.getLogger().debug("Setting up selenium for {}", browser);

    DesiredCapabilities capabilities = null;

    switch (browser.toLowerCase()) {
        case "chrome":
            ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.addArguments("--no-sandbox");
            chromeOptions.addArguments("--ignore-certificate-errors");
            capabilities = DesiredCapabilities.chrome();
            capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
            break;
        case "firefox":
            capabilities = DesiredCapabilities.firefox();
            break;
        case "phantomjs":
            capabilities = DesiredCapabilities.phantomjs();
            break;
        case "iphone":
        case "safari":
            capabilities = DesiredCapabilities.iphone();
            capabilities.setCapability("platformName", "iOS");
            capabilities.setCapability("platformVersion", "8.1");
            capabilities.setCapability("deviceName", "iPhone Simulator");
            break;
        case "android":
            capabilities = DesiredCapabilities.android();
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("platformVersion", "6.0");
            capabilities.setCapability("deviceName", "Android Emulator");
            capabilities.setCapability("app", "Browser");
            break;
        default:
            commonspec.getLogger().error("Unknown browser: " + browser);
            throw new SeleniumException("Unknown browser: " + browser);
    }

    capabilities.setVersion(version);

    grid = "http://" + grid + "/wd/hub";
    HttpClient.Factory factory = new ApacheHttpClient.Factory(new HttpClientFactory(60000, 60000));
    HttpCommandExecutor executor = new HttpCommandExecutor(new HashMap<String, CommandInfo>(), new URL(grid), factory);
    commonspec.setDriver(new RemoteWebDriver(executor, capabilities));
    commonspec.getDriver().manage().timeouts().pageLoadTimeout(PAGE_LOAD_TIMEOUT, TimeUnit.SECONDS);
    commonspec.getDriver().manage().timeouts().implicitlyWait(IMPLICITLY_WAIT, TimeUnit.SECONDS);
    commonspec.getDriver().manage().timeouts().setScriptTimeout(SCRIPT_TIMEOUT, TimeUnit.SECONDS);

    commonspec.getDriver().manage().deleteAllCookies();
    if (capabilities.getCapability("deviceName") == null) {
        commonspec.getDriver().manage().window().setSize(new Dimension(1440, 900));
    }
    commonspec.getDriver().manage().window().maximize();

}
 
开发者ID:Stratio,项目名称:bdt,代码行数:75,代码来源:HookGSpec.java


示例7: newVendorCommand

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
private static CommandInfo newVendorCommand(String path, HttpMethod method) {
  return new CommandInfo(VENDOR_PREFIX + path, method);
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:4,代码来源:SelendroidCommandExecutor.java


示例8: getC

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
/**
 * This methods forms GET commands.
 *
 * @param url is the command URL
 * @return an instance of {@link org.openqa.selenium.remote.CommandInfo}
 */
public static CommandInfo getC(String url) {
    return new CommandInfo(url, HttpMethod.GET);
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:10,代码来源:MobileCommand.java


示例9: postC

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
/**
 * This methods forms POST commands.
 *
 * @param url is the command URL
 * @return an instance of {@link org.openqa.selenium.remote.CommandInfo}
 */
public static CommandInfo postC(String url) {
    return new CommandInfo(url, HttpMethod.POST);
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:10,代码来源:MobileCommand.java


示例10: deleteC

import org.openqa.selenium.remote.CommandInfo; //导入依赖的package包/类
/**
 * This methods forms DELETE commands.
 *
 * @param url is the command URL
 * @return an instance of {@link org.openqa.selenium.remote.CommandInfo}
 */
public static CommandInfo deleteC(String url) {
    return new CommandInfo(url, HttpMethod.DELETE);
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:10,代码来源:MobileCommand.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MimeUtil类代码示例发布时间:2022-05-22
下一篇:
Java Captcha类代码示例发布时间: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