This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

Hey there,
I'll first explain what my goal is, and then I'll explain my current strategy:

Goal - within the appium test run, call out to a script on the host to do X. Currently X = a shell script to shape the network.

Here's currently what I have:

 $driver.execute_script 'UIATarget.localTarget().host().performTaskWithPathArgumentsTimeout(\'../appium-bbcommon.d/bin/shape_network.sh\',[\'internet_off\'],2)'

Expected Result: Called out to shape_network.sh and turns internet off
Actual Result:

info: [debug] Socket data received (123 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":17,"value":"Communication to the host was lost, and the task performed on host was terminated due to timeout."}
info: [debug] Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"Communication to the host was lost, and the task performed on host was terminated due to timeout."},"sessionId":"33829580-a7d2-4e2e-8b11-a6d6b1c22d30"}
info: <-- POST /wd/hub/session/33829580-a7d2-4e2e-8b11-a6d6b1c22d30/execute 500 22900.159 ms - 258 
Selenium::WebDriver::Error::JavascriptError: Communication to the host was lost, and the task performed on host was terminated due to timeout.
from /Users/esherman/.rvm/gems/ruby-2.1.2/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'

Any guidance would be most useful.
Much thanks!
Eric

  • created

    Aug '15
  • last reply

    Aug '15
  • 1

    reply

  • 1.4k

    views

  • 1

    user

I figured this out.
Instead of execute_script, I decided to use the system command.
Example:
def shape_3G
system("../appium-bbcommon.d/bin/shape_network.sh","shape_3G")
end

Thanks.