Browserstackからこのセレンテストコードを実行しようとしていますが、私はエラーを受け取りません。Javaテストを使用しているセレンとブラウザスタックは動作しません。
コード:
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
public class JavaSample {
public static final String USERNAME = "username";
public static final String AUTOMATE_KEY = "key";
public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-cloud.browserstack.com/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "IE");
caps.setCapability("browser_version", "7.0");
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "XP");
caps.setCapability("browserstack.debug", "true");
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("BrowserStack");
element.submit();
System.out.println(driver.getTitle());
driver.quit();
}
}
私は取得していますエラーは、私がプロジェクトにセレンライブラリとJavaのライブラリを持っている
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
The method sendKeys(CharSequence...) from the type WebElement refers to the missing type CharSequence
at mypackage.JavaSample.main(JavaSample.java:30)
です。私は日食を使用しています。
ご迷惑をおかけしましたか?あなたは何を見つけましたか?この問題を解決するために何を試みましたか? – JeffC
メインクラス自体の変数を初期化してみてください – SaiPawan
あなたのスクリプトは正常に動作しています。私はちょうど試みた。 – SaiPawan