admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

synchronous REPL mode? #606

Open jrr opened 5 years ago

jrr commented 5 years ago

When I connect the REPL using .remote() like in the example, the commands seem not to return anything.

yarn run wd shell
(...)
(wd): x = wd.remote("localhost",4723)
(... )
(wd): x.init({platformName:"iOS",deviceName:"test-ipad",automationName:"XCUITest",platformVersion:"12.2", app: "./ios/build/MyApp/Build/Products/Debug-iphonesimulator/MyApp.app" })
undefined
(wd): x.contexts()
undefined

At this point I can see in my appium server window that it worked:

[debug] [MJSONWP (a89051aa)] Responding to client with driver.getContexts() result: ["NATIVE_APP","WEBVIEW_30703.2"]
[HTTP] <-- GET /wd/hub/session/a89051aa-c612-4389-9a3e-6999cf12d535/contexts 200 119 ms - 104
[HTTP]

..but the function just returned undefined in the REPL.

Is this supposed to work synchronously?

I'm also able to use wd.promiseChainRemote(), but it's awkward to use promises in the REPL.