首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Selenium与BrowserMob-Proxy

Selenium与BrowserMob-Proxy
EN

Stack Overflow用户
提问于 2013-12-11 01:22:15
回答 2查看 3.9K关注 0票数 0

我开始写一些关于Selenium的测试,我想如果我能获得性能指标,那就太好了,比如登录到我们的网站。我遇到了BrowserMob-Proxy。我从Lightbody的github页面复制前五行开始,我已经收到错误消息:"ProxyServer无法解析为类型“和"Proxy无法解析为类型”。

有人能告诉我这里还缺少什么吗?

下面是pom.xml:

代码语言:javascript
复制
...
</plugins>
</build>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-impl</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- 20131112 ab hier neu hinzugefügt von "https://docs.jboss.org/author/display/ARQ/Drone" -->
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-webdriver-depchain</artifactId>
        <version>${version.org.jboss.arquillian.drone}</version>
        <type>pom</type>
        <scope>test</scope>
    </dependency>
    <!-- bis hier -->
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-selenium</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-selenium-server</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>servlet-api-2.5</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.lightbody.bmp</groupId>
        <artifactId>browsermob-proxy</artifactId>
        <version>LATEST_VERSION (ex: 2.0-beta-9)</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>
<profiles>
    <profile>
        <id>arquillian-weld-ee-embedded</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-6.0</artifactId>
                <version>1.0.0.Final</version>
                <type>pom</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
                <version>1.0.0.CR3</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.weld</groupId>
                <artifactId>weld-core</artifactId>
                <version>1.1.5.Final</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.6.4</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>
    <profile>
        <id>arquillian-glassfish-embedded</id>
        <dependencies>
...

这是我试图让方法'start‘和'end’('start‘还没有完成,我也没有'end'...)的类。通过调用' start‘,BrowserMob应该开始测量性能,而在'end’的时候,它应该停止测量...

代码语言:javascript
复制
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Timer {

public void start() {

    // start the proxy
    ProxyServer server = new ProxyServer(4444);
    server.start();

    // get the Selenium proxy object
    Proxy proxy = server.seleniumProxy();

    // configure it as a desired capability
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, proxy);

    // start the browser up
    WebDriver driver;

}

}
EN

回答 2

Stack Overflow用户

发布于 2014-01-22 07:07:21

您的问题出在版本行上。它看起来像是直接从browsermob github页面复制和粘贴的。相反,这条线应该看起来像这样。

代码语言:javascript
复制
<version>2.0-beta-9</version>   

删除LATEST_VERSION和其他语法。

票数 2
EN

Stack Overflow用户

发布于 2016-05-14 10:16:33

尝试新服务器= BrowserMobProxyServer BrowserMobProxyServer();,然后从其中获取常规代理。是的,获取最新版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20501095

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档