<tfoot id='mDo3E'></tfoot>

  1. <small id='mDo3E'></small><noframes id='mDo3E'>

    <legend id='mDo3E'><style id='mDo3E'><dir id='mDo3E'><q id='mDo3E'></q></dir></style></legend>

      • <bdo id='mDo3E'></bdo><ul id='mDo3E'></ul>

    1. <i id='mDo3E'><tr id='mDo3E'><dt id='mDo3E'><q id='mDo3E'><span id='mDo3E'><b id='mDo3E'><form id='mDo3E'><ins id='mDo3E'></ins><ul id='mDo3E'></ul><sub id='mDo3E'></sub></form><legend id='mDo3E'></legend><bdo id='mDo3E'><pre id='mDo3E'><center id='mDo3E'></center></pre></bdo></b><th id='mDo3E'></th></span></q></dt></tr></i><div id='mDo3E'><tfoot id='mDo3E'></tfoot><dl id='mDo3E'><fieldset id='mDo3E'></fieldset></dl></div>

      如何正确设置 Java/Selenium 配置以运行自动化测试?

      How to properly set up Java/Selenium configuration to run automated tests?(如何正确设置 Java/Selenium 配置以运行自动化测试?)
          <tbody id='FhjVl'></tbody>

      1. <legend id='FhjVl'><style id='FhjVl'><dir id='FhjVl'><q id='FhjVl'></q></dir></style></legend>

          <tfoot id='FhjVl'></tfoot>
            <bdo id='FhjVl'></bdo><ul id='FhjVl'></ul>
              • <small id='FhjVl'></small><noframes id='FhjVl'>

                <i id='FhjVl'><tr id='FhjVl'><dt id='FhjVl'><q id='FhjVl'><span id='FhjVl'><b id='FhjVl'><form id='FhjVl'><ins id='FhjVl'></ins><ul id='FhjVl'></ul><sub id='FhjVl'></sub></form><legend id='FhjVl'></legend><bdo id='FhjVl'><pre id='FhjVl'><center id='FhjVl'></center></pre></bdo></b><th id='FhjVl'></th></span></q></dt></tr></i><div id='FhjVl'><tfoot id='FhjVl'></tfoot><dl id='FhjVl'><fieldset id='FhjVl'></fieldset></dl></div>
                本文介绍了如何正确设置 Java/Selenium 配置以运行自动化测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试设置 selenium webdriver 以与带有 Java 的 Browserstack 一起使用以进行自动化测试.我为 Java 安装了 Selenium,并从 browserstack 的站点 https://www 复制并粘贴了代码.browserstack.com/automate/java#configure-capabilities 设置一个示例自动化测试.

                I am trying to set up selenium webdriver to work together with Browserstack with Java for automated testing. I installed the Selenium for java and I copied and pasted the code from browserstack's site https://www.browserstack.com/automate/java#configure-capabilities to set up an example automation test.

                我从终端运行了 javac -classpath selenium-server-standalone-2.48.2.jar JavaSample.java(JavaSample.java 是带有示例测试的 selenium 配置代码的文件)和我收到以下错误:

                I ran javac -classpath selenium-server-standalone-2.48.2.jar JavaSample.java from my terminal (JavaSample.java is the file with the selenium configuration code with the sample test) and I get the following error:

                JavaSample.java:1: error: package org.openqa.selenium does not exist
                import org.openqa.selenium.By;
                                      ^
                JavaSample.java:2: error: package org.openqa.selenium does not exist
                import org.openqa.selenium.Platform;
                                      ^
                JavaSample.java:3: error: package org.openqa.selenium does not exist
                import org.openqa.selenium.WebDriver;
                                      ^
                JavaSample.java:4: error: package org.openqa.selenium does not exist
                import org.openqa.selenium.WebElement;
                                      ^
                JavaSample.java:5: error: package org.openqa.selenium.remote does not exist
                import org.openqa.selenium.remote.DesiredCapabilities;
                                             ^
                JavaSample.java:6: error: package org.openqa.selenium.remote does not exist
                import org.openqa.selenium.remote.RemoteWebDriver;
                                             ^
                JavaSample.java:18: error: cannot find symbol
                DesiredCapabilities caps = new DesiredCapabilities();
                ^
                symbol:   class DesiredCapabilities
                location: class JavaSample
                JavaSample.java:18: error: cannot find symbol
                DesiredCapabilities caps = new DesiredCapabilities();
                                               ^
                symbol:   class DesiredCapabilities
                location: class JavaSample
                JavaSample.java:25: error: cannot find symbol
                WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
                ^
                symbol:   class WebDriver
                location: class JavaSample
                JavaSample.java:25: error: cannot find symbol
                WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
                                       ^
                symbol:   class RemoteWebDriver
                location: class JavaSample
                JavaSample.java:27: error: cannot find symbol
                WebElement element = driver.findElement(By.name("q"));
                ^
                symbol:   class WebElement
                location: class JavaSample
                JavaSample.java:27: error: cannot find symbol
                WebElement element = driver.findElement(By.name("q"));
                                                        ^
                symbol:   variable By
                location: class JavaSample
                

                我不知道该怎么做,因为我只是按照 Browserstack 上的说明进行操作,而且我对 Java 的背景很少.

                I'm not sure how to go about this being as I just followed the instructions on Browserstack and I have very little background in Java.

                推荐答案

                您必须从 Selenium 下载.您可以点击此处.

                You will have to download the "Selenium Client & WebDriver Language Bindings" for Java from Selenium Downloads. You can download directly by clicking the link here.

                包括下载的 ZIP 文件中存在的所有 JAR 文件.要在 Java 类路径中包含多个 JAR,您可以查看此处的链接.

                Include all the JAR files that are present in the downloaded ZIP file. To include multiple JARs in Java classpath, you can check the link here.

                如果您在本地运行测试,则需要 selenium-server-standalone JAR.执行命令 java -jar selenium-server-standalone-2.48.2.jar 将启动一个 Selenium 服务器,它需要在本地启动 Selenium 测试.如果您在 BrowserStack 上运行测试,则不需要使用它.

                The selenium-server-standalone JAR is required if you are running your tests locally. Executing the command java -jar selenium-server-standalone-2.48.2.jar will start a Selenium server, which required to launch Selenium tests locally. You need not use it, if you are running tests on BrowserStack.

                还建议使用适用于 Java 的 IDE.最普遍推荐的是 IntelliJ Idea、Eclipse 和 Netbeans.

                Would also recommend using an IDE for Java. The most commonly recommended ones are IntelliJ Idea, Eclipse, and Netbeans.

                这篇关于如何正确设置 Java/Selenium 配置以运行自动化测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
                Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
                How to convert Integer to int?(如何将整数转换为整数?)
                How do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
                Inconsistent behavior on java#39;s ==(java的行为不一致==)
                Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)

                • <bdo id='Fyxmo'></bdo><ul id='Fyxmo'></ul>
                • <tfoot id='Fyxmo'></tfoot>
                • <i id='Fyxmo'><tr id='Fyxmo'><dt id='Fyxmo'><q id='Fyxmo'><span id='Fyxmo'><b id='Fyxmo'><form id='Fyxmo'><ins id='Fyxmo'></ins><ul id='Fyxmo'></ul><sub id='Fyxmo'></sub></form><legend id='Fyxmo'></legend><bdo id='Fyxmo'><pre id='Fyxmo'><center id='Fyxmo'></center></pre></bdo></b><th id='Fyxmo'></th></span></q></dt></tr></i><div id='Fyxmo'><tfoot id='Fyxmo'></tfoot><dl id='Fyxmo'><fieldset id='Fyxmo'></fieldset></dl></div>
                    <tbody id='Fyxmo'></tbody>
                • <legend id='Fyxmo'><style id='Fyxmo'><dir id='Fyxmo'><q id='Fyxmo'></q></dir></style></legend>

                  <small id='Fyxmo'></small><noframes id='Fyxmo'>