Есть отличная удаленная работа для php+codeception+jenkins+allure+docker спецов. 100% remote! Присоединиться к проекту

Не могу побороть ошибку при запуске теста через appium! Плиз помощь!


(Никита Ткаленко) #1

Собственно сама ошибка в ide
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Command ‘java -version’ exited with code 2

В консоли appium:
Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {“desiredCapabilities”:{“browserName”:“chrome”,“platformName”:“Android”,“deviceName”:“Pixel”,“platformVersion”:“7.0”},“capabilities”:{“desiredCapabilities”:{“browserName”:“chrome”,“deviceName”:“Pixel”,“platformName”:“Android”,“platformVersion”:“7.0”},“firstMatch”:[{“browserName”:“chrome”,“platformName”:“android”}]}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“browserName”:“chrome”,“platformName”:“Android”,“deviceName”:“Pixel”,“platformVersion”:“7.0”},null,{“desiredCapabilities”:{“browserName”:“chrome”,“deviceName”:“Pixel”,“platformName”:“Android”,“platformVersion”:“7.0”},“firstMatch”:[{“browserName”:“chrome”,“platformName”:“android”}]}]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1536832260579 (12:51:00 GMT+0300 (Финляндия (лето)))
[Appium] Could not parse W3C capabilities: ‘deviceName’ can’t be blank
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The capabilities [“deviceName”,“platformVersion”] are not standard capabilities and should have an extension prefix
[Appium] Consider setting ‘automationName’ capability to ‘UiAutomator2’ on Android >= 6, since UIAutomator framework is not maintained anymore by the OS vendor.
[Appium] Creating new AndroidDriver (v3.7.0) session
[Appium] Capabilities:
[Appium] deviceName: Pixel
[Appium] platformVersion: 7.0
[Appium] browserName: chrome
[Appium] platformName: android
[debug] [BaseDriver] W3C capabilities {“alwaysMatch”:{"appium:dev… and MJSONWP desired capabilities {“browserName”:“chrome”,"pl… were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {“alwaysMatch”:{"appium:dev…
[BaseDriver] Session created with session id: 23791da5-4b7c-49a1-a549-524244fbff32
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Called deleteSession but bootstrap wasn’t active
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1536832260650 (12:51:00 GMT+0300 (Финляндия (лето)))
[W3C] Encountered internal error running command: Error: Command ‘java -version’ exited with code 2
[W3C] at ChildProcess. (C:\Users\n111k\AppData\Roaming\npm\node_modules\appium\node_modules\teen_process\lib\exec.js:94:19)
[W3C] at emitTwo (events.js:125:13)
[W3C] at ChildProcess.emit (events.js:213:7)
[W3C] at maybeClose (internal/child_process.js:927:16)
[W3C] at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
[HTTP] <-- POST /wd/hub/session 500 88 ms - 1355

Код теста:

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.net.URL;

public class MobileTest {
    private WebDriver driver;

    @Before
    public void setUp() throws Exception {
        
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "Pixel");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("platformVersion", "7.0");
        capabilities.setCapability("browserName", "chrome");
        driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),
                capabilities);
        //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
    @Test
    public void testMoyo() throws Exception {
        driver.get("my url");
        Thread.sleep(1000);
        driver.findElement(By.cssSelector(".cart-inner-link")).click();
        System.out.println(driver.getCurrentUrl());
    }
    @After
    public void tearDown() throws Exception {
        driver.quit();
    }

    }


#2

Эмулятор?


(y0ga) #3

Java и $JAVA_HOME проверяли?


(Никита Ткаленко) #4

Да эмулятор


(Никита Ткаленко) #5

Действительно проблема была в $JAVA_HOME, все запустилось только теперь локаторы почему то не срабатывают, открывается сайт и ждет у моря погоды… А в консоли Apium вот такое подряд и много раз))

[HTTP] --> POST /wd/hub/session/0414dcd5-e506-4c21-a470-1db22a5c9f0b/element
[HTTP] {"value":"#search-field","using":"css selector"}
[W3C] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Matched '/wd/hub/session/0414dcd5-e506-4c21-a470-1db22a5c9f0b/element' to command name 'findElement'
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/0414dcd5-e506-4c21-a470-1db22a5c9f0b/element] to [POST http://127.0.0.1:8000/wd/hub/session/09bd10a29d276831323c071196d4ac44/element] with body: {"value":"#search-field","using":"css selector"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"09bd10a29d276831323c071196d4ac44","status":0,"value":{"ELEMENT":"0.4668795936433756-1"}}
[JSONWP Proxy] Replacing sessionId 09bd10a29d276831323c071196d4ac44 with 0414dcd5-e506-4c21-a470-1db22a5c9f0b
[HTTP] <-- POST /wd/hub/session/0414dcd5-e506-4c21-a470-1db22a5c9f0b/element 200 60 ms - 106