microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.41k forks source link

What could be the reason for 'Unable to create a new remote session' error #1268

Open mbrundavanam opened 4 years ago

mbrundavanam commented 4 years ago

What could be the reason for below error code snippet :

public class Sample { static String AppExePath = "C:\Program Files (x86)\BRU\BRUAPP\BRUGui.exe"; static String appiumDriverURI = "http://127.0.0.1:4723"; public static WindowsDriver desktopSession = null;

@BeforeClass
public static void setup() {

    try {
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability("app", AppExePath);
        cap.setCapability("platformName", "Windows");
        cap.setCapability("deviceName", "WindowsPC");

        desktopSession = new WindowsDriver(new URL(appiumDriverURI), cap);
        desktopSession.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    } catch (Exception ee) {
        System.out.println("###### in catch:: ");
        ee.printStackTrace();

Error:
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: Failed to locate opened application window with appId: C:\Program Files (x86)\DST\TA2000\TaGui.exe, and processId: 18852 (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.72 seconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'xxx0392', ip: '192.169.1.103', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_191' Driver info: driver.version: WindowsDriver Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'HDLT0392', ip: '192.168.1.101', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_191' Driver info: driver.version: WindowsDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)

anunay1 commented 4 years ago

Is development mode On on your PC.

mbrundavanam commented 4 years ago

Yes

mbrundavanam commented 4 years ago

now getting below error however this window opened and able to find the 'Logon : Test App' name with the window.. added sleep time as 20 sec. but no luck.. can someone please help on this

Am using Java

========================================== GET /session/DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE/window_handles HTTP/1.1 Accept-Encoding: gzip Cache-Control: no-cache Connection: Keep-Alive Host: 127.0.0.1:4723 User-Agent: selenium/3.141.59 (java windows)

HTTP/1.1 200 OK Content-Length: 74 Content-Type: application/json

{"sessionId":"DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE","status":0,"value":[]}

========================================== POST /session/DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE/element HTTP/1.1 Accept-Encoding: gzip Connection: Keep-Alive Content-Length: 58 Content-Type: application/json; charset=utf-8 Host: 127.0.0.1:4723 User-Agent: selenium/3.141.59 (java windows)

{ "using": "name", "value": "Logon : Test App" } HTTP/1.1 404 Not Found Content-Length: 139 Content-Type: application/json

{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

anunay1 commented 4 years ago

now getting below error however this window opened and able to find the 'Logon : Test App' name with the window.. added sleep time as 20 sec. but no luck.. can someone please help on this

Am using Java

========================================== GET /session/DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE/window_handles HTTP/1.1 Accept-Encoding: gzip Cache-Control: no-cache Connection: Keep-Alive Host: 127.0.0.1:4723 User-Agent: selenium/3.141.59 (java windows)

HTTP/1.1 200 OK Content-Length: 74 Content-Type: application/json

{"sessionId":"DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE","status":0,"value":[]}

========================================== POST /session/DEC945EE-93AC-4FD6-BE0A-6BA576E1DDBE/element HTTP/1.1 Accept-Encoding: gzip Connection: Keep-Alive Content-Length: 58 Content-Type: application/json; charset=utf-8 Host: 127.0.0.1:4723 User-Agent: selenium/3.141.59 (java windows)

{ "using": "name", "value": "Logon : Test App" } HTTP/1.1 404 Not Found Content-Length: 139 Content-Type: application/json

{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

what is shown in inspect?

mbrundavanam commented 4 years ago

Interestingly the same code is working in other machine without any issues but am getting above specified error. :(