Andry
Andry

Reputation: 16875

ExecuteScript returns null in Appium?

I am using Appium, WebDrive and Selenium for C# to test some app on my Android device. The device on which I am testing is not important, just reporting for completeness.

I do the following at a certain point:

driver = new AppiumDriver(...);
var isNull = driver.ExecuteScript("window == null;");

My test works and it is executed (both on device and simulator), however isNull is always null.

How to return from ExecuteScript? Thank you

Upvotes: 0

Views: 1203

Answers (1)

Arran
Arran

Reputation: 25076

You need to tell WebDriver to "return" it - in the same way that if you didn't specify a "return" value from a method, it wouldn't return anything.

var isNull = driver.ExecuteScript("return window == null;");

Upvotes: 1

Related Questions