Невозможно передать URL в мобильном браузере chrome в Appium - PullRequest
0 голосов
/ 27 января 2020
public class ChromeTest {

    //Instantiate Appium Driver
        static AppiumDriver<MobileElement> driver;


    public static void main(String[] args) throws MalformedURLException {

        //need to set W3c command for chome as follows:

         ChromeOptions opt = new ChromeOptions();
            opt.setExperimentalOption("w3c", true);

/*          ChromeDriver driver = new ChromeDriver(opt);
*/        



        //Set the Desired Capabilities
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("deviceName", "Moto E4");
        caps.setCapability("udid", "ZW2222CPX2"); //Give Device ID of your mobile phone
        caps.setCapability("platformName", "Android");
        caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
        caps.setCapability("browserName", "Chrome");
        caps.setCapability("noReset", true);
        caps.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);
        caps.setCapability(MobileCapabilityType.FORCE_MJSONWP, true);
        caps.setCapability(AndroidMobileCapabilityType.SUPPORTS_ALERTS,false);

        //Set ChromeDriver location
        System.setProperty("webdriver.chrome.driver","C:\\Users\\likitha\\estockgfits\\AppiumTest\\chromedriver.exe");







/*      try {
*/          driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);

        /*} catch (MalformedURLException e) {
            System.out.println(e.getMessage());
        }*/
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

        //Open URL in ChromeBrowser

        driver.get("http://www.estockgifts.com");

        //wait
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);


    }
}

вышеупомянутый мой код и ошибка, показанная в eclipse, была следующей:

Информация о драйвере: driver.version: AndroidDriver в io.appium.java_client.remote.AppiumCommandExecutor.lambda 5 долларов США (AppiumCommandExecutor. java: 251) по адресу java .util.Optional.orElseGet (Необязательно. java: 267) по адресу io.appium.java_client.remote.AppiumCommandExecutor.execute (AppiumCommandExecutor. * 1012): в org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver. java: 552) в io.appium.java_client.DefaultGenericMobileDriver.execute (DefaultGenericMobileDriver. java: 42.jpg.a. (AppiumDriver. java: 1) в io.appium.java_client. android .AndroidDriver.execute (AndroidDriver. java: 1) в org.openqa.selenium.remote.RemoteWebDriver.startSession (RemoteWebDriver. * 1018 : 213) в org.openqa.selenium.remote.RemoteWebDriver. (RemoteWebDriver. java: 131) в io.appium.java_client.DefaultGenericMobileDriver. (DefaultGenericMobileDriver. java: 38) в io.clie.jpg nt.AppiumDriver. (AppiumDriver. java: 84) в io.appium.java_client.AppiumDriver. (AppiumDriver. java: 94) в io.appium.java_client. android .AndroidDriver. (AndroidDriver. java : 95) at demo.ChromeTest.main (ChromeTest. java: 56). Причина: java. net .ConnectException: соединение отклонено: соединение в java. net .DualStackPlainSocketImpl.waitForConnect (собственный метод ) в java. net .DualStackPlainSocketImpl.socketConnect (DualStackPlainSocketImpl. java: 85) в java. net .AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl *. java 36. 350) в * .AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl. java: 204) в java. net .AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl. java: 188) в java. java: 172) в java. net .SocksSocketImpl.connect (SocksSocketImpl. java: 392) в java. net .Socket.connect (Socket. java: 589) в okhttp3 .internal.platform.Platform.connectSocket (Platform. java: 129) по адресу okhttp3.inte rnal.connection.RealConnection.connectSocket (RealConnection. java: 245) по адресу okhttp3.internal.connection.RealConnection.connect (RealConnection. java: 165) по адресу okhttp3.internal.connection.StreamAllocation.findConnection (StreamAllocation. *: 257) в okhttp3.internal.connection.StreamAllocation.findHealthyConnection (StreamAllocation. java: 135) в okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation. java: 114) в okhttp3.internal.connect .intercept (ConnectInterceptor. java: 42) в okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain. java: 147) в okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain. okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor. java: 93) в okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain. java: 147) в okhttp3.internal.http. ReinInterter java: 121) по адресу okhttp3.internal.http.BridgeInterceptor.interce pt (BridgeInterceptor. java: 93) в okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain. java: 147) в okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAnt) .internal.http.RealInterceptorChain. ) в okhttp3.RealCall.execute (RealCall. java: 77) в org.openqa.selenium.remote.internal.OkHttpClient.execute (OkHttpClient. java: 103) в org.openqa.selenium.remote.ProtocolHandske createSession (ProtocolHandshake. java: 105) в sun.reflect.NativeMethodAccessorImpl. invoke0 (нативный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java: 62) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl. java 63.fl. invoke (Метод. java: 498) в io.appium.java_client.remote.AppiumCommandExecutor $ 1.createSession (AppiumCommandExecutor. java: 186) в io.appium.java_client.remote.AppiumCommandExecutor.ciumateExecutor (App. : 217) at io.appium.java_client.remote.AppiumCommandExecutor.execute (AppiumCommandExecutor. java: 239) ... еще 11

Как решить эту ошибку.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...