4

プロパティを介して Cucumber で (OWASP ZAP プロキシ ポートへの) プロキシを設定しようとしていますが、利用できません。

きゅうり.xml

  <beans profile="firefoxRemote">
        <bean name="capability" init-method="firefox"
              class="org.openqa.selenium.remote.DesiredCapabilities">
            <property name="browserName" value="firefox"/>
            <property name="version" value="42.0"/>
            <property name="PROXY" value="127.0.0.1:8090"/>
        </bean>

CucumberRunner でも設定できますが、方法がわかりません。

@RunWith(Cucumber.class)
@CucumberOptions(
        features = {"src/test/java/com/features"},
        glue = "com.mycompany.steps",
        format = {"pretty", "html:target/cucumber", "json:target/cucumber.json"},
        tags = {"~@ignore"})
public class CucumberRunner {
}

これを正しく設定する方法と場所を知っている人はいますか?

Selenium と Webdriver を使用すると、次のように実行できます。

public class ZAPRunner {

    private WebDriver driver;
    private String site = "http://localhost:8080/app";

    public void setUp() throws Exception {
        Proxy proxy = new Proxy();
        proxy.setHttpProxy("localhost:8090");
        proxy.setFtpProxy("localhost:8090");
        proxy.setSslProxy("localhost:8090");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.PROXY, proxy);
        driver = new FirefoxDriver(capabilities);
        this.setDriver(driver);
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
    protected void setDriver(WebDriver driver) {
        this.driver = driver;
    }


    public static void main(String[] args) throws Exception {
        ZAPRunner test = new ZAPRunner();
        test.setUp();

    }

}

しかし、キュウリでこれを達成する方法は? テストはすでに書かれているので、Cucumberを使いたいです。

ありがとう、

4

0 に答える 0