1

モバイル デバイスの Chrome ブラウザが起動および終了し、ブラウザで URL が取得されません。Eclipse: 酸素 1.0 Samsung S5 Appium バージョン: 1.4.16 ブラウザ: Chrome。

モバイル ブラウザで「us.justdial.com」という URL にアクセスしようとしています。デバイス ブラウザが 4 回連続して起動および終了し、スクリプトが失敗します。

以下はエラーレポートです。

[RemoteTestNG] detected TestNG version 6.13.1
FAILED: Appium_device1
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: A new session could not be created. (Original error: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"15216.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=55.0.2883.91)
  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86))) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.09 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'MUM-SOFT-VAIBHA', ip: '172.29.5.188', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: AndroidDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
    at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:83)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:93)
    at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72)
    at Appium_device.Appium_device1(Appium_device.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:571)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
    at org.testng.TestNG.runSuites(TestNG.java:1028)
    at org.testng.TestNG.run(TestNG.java:996)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


===============================================
    Default test
    Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0

テスト スクリプトは次のとおりです。

import java.net.MalformedURLException;
import java.net.URL;
//import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
//import org.openqa.selenium.remote.RemoteWebDriver;
//import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;

public class Appium_device {
    @Test
    public void Appium_device1() throws MalformedURLException, InterruptedException {
    //APPLICATION_LOG.info("Initializing project properties");
    DesiredCapabilities capabilities = new DesiredCapabilities();

      // Set android deviceName desired capability. Set your device name.
    //  capabilities.setCapability("deviceName", "5203a1bbea4a8385");
    //  capabilities.setCapability("deviceName", "4100df0accbd9f00");
    //   capabilities.setCapability("deviceName", "0123456789ABCDEF");
      capabilities.setCapability("deviceName", "4d007af54ac04177");

      // Set BROWSER_NAME desired capability. It's Android in our case here.
      capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
    // capabilities.setCapability("browsername", "chrome");

      // Set android VERSION desired capability. Set your mobile device's OS version.
    //  capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
    // capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
    capabilities.setCapability(CapabilityType.VERSION, "6.0.1");

      // Set android platformName desired capability. It's Android in our case here.
      capabilities.setCapability("platformName", "Android");

      // Set android appPackage desired capability. It is
      // com.android.calculator2 for calculator application.
      // Set your application's appPackage if you are using any other app.
    // capabilities.setCapability("appPackage", "org.mozilla.firefox");
      capabilities.setCapability("appPackage", "com.android.chrome");


      // Set android appActivity desired capability. It is
      // com.android.calculator2.Calculator for calculator application.
      // Set your application's appPackage if you are using any other app.
      capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");

      // Created object of RemoteWebDriver will all set capabilities.
      // Set appium server address and port number in URL string.
      // It will launch calculator app in android device.
    //   webdriver.Chrome(executable_path='C:\Users\Ganeshkumarg\Downloads\chromedriver_win32\chromedriver.exe');
     URL url = new URL("http://127.0.0.1:4723/wd/hub");
     // webDriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

      WebDriver driver = new AndroidDriver (url, capabilities);
      Thread.sleep(10000);
      driver.get("us.justdial.com");
        Thread.sleep(5000);
        System.out.println("Site hit");
        //exclewrtdt.writeData("Launched justdial website", "true");
        Thread.sleep(3000);
    }
}

Appium ログのスクリーンショットを参照してください。

併せてご検討くださいますようお願い申し上げます。ここに画像の説明を入力

4

4 に答える 4

1

すべての提案と回答に感謝します。最後に、appium を更新し、@dmle メソッドを使用しました

"AppiumDriver driver = new AndroidDriver(
    new URL("http://127.0.0.1:4723/wd/hub"),
    capabilities
 );"

同じように働きました。

ありがとう

于 2017-12-29T10:39:14.940 に答える