Skip to content

ScrollToVisible throws an exception in webview on iOS #195

@ramgokul

Description

@ramgokul

Selenium Version: 2.43.1
Xcode version: 6.3.1
OSX version: 10.10.3

What I am trying to do:

  1. Launch iphone 6 simulator
  2. Launch UICatalog app
  3. Click on the 'left' button
  4. Scroll to Web View'. Tap on it
  5. Click on the ‘Menu’ button. Many sublinks like Store, Mac, iPhone, Watch…..Support are displayed.
  6. Scroll upto the last link (I,e Support) and click on it

Code:
cap = new DesiredCapabilities();
cap.setCapability("deviceName", "iPhone 6”);
cap.setCapability("platformName", "iOS");
cap.setCapability("platformVersion", "8.3");
cap.setCapability("app", appFile.getAbsolutePath());

dr = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap);
dr.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
dr.findElementByIosUIAutomation("UIATarget.localTarget().frontMostApp().navigationBar().leftButton()").click();
dr.findElementByIosUIAutomation("UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()["Web View"]").click();
dr.findElementByXPath("//UIAButton[@name='Menu']").click();
Thread.sleep(5000);
dr.executeScript("UIATarget.localTarget().frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"].scrollToVisible();");

Observation:

I see that the scroll happening successfully upto the ‘Support’ link. However, the script exits at this point with an exception (An error occurred while executing user supplied JavaScript.). What am I doing wrong?

Appium logs:
info: [debug] [INST] 2015-05-13 16:11:07 +0000 Debug: Got new command 10 from instruments: UIATarget.localTarget().frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"].scrollToVisible();

info: [debug] [INST] 2015-05-13 16:11:07 +0000 Debug: evaluating UIATarget.localTarget().frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"].scrollToVisible();
info: [debug] [INST] 2015-05-13 16:11:07 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"].scrollToVisible()

info: [debug] [INST] 2015-05-13 16:11:07 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"] - scrollToVisible could not generate a scroll to make the element visible.

info: [debug] [INST] 2015-05-13 16:11:07 +0000 Error: VerboseError: target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"] - scrollToVisible could not generate a scroll to make the element visible.
info: [debug] Socket data received (187 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":17,"value":"target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"] - scrollToVisible could not generate a scroll to make the element visible."}
info: [debug] Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["Support"] - scrollToVisible could not generate a scroll to make the element visible."},"sessionId":"298c81f6-c1ea-46b3-94b9-1cc00893d285"}
info: <-- POST /wd/hub/session/298c81f6-c1ea-46b3-94b9-1cc00893d285/execute 500 1266.408 ms - 322
info: --> DELETE /wd/hub/session/298c81f6-c1ea-46b3-94b9-1cc00893d285 {}
info: Shutting down appium session
info: [debug] Stopping ios
info: [debug] Destroying instruments client socket.
info: [debug] Closing socket server.
info: [debug] Instruments socket server was closed
info: [debug] Sending sigterm to instruments
info: [debug] [INST] 2015-05-13 16:11:07 +0000 Stopped: Script was stopped by the user
info: [IOS_SYSLOG_ROW ] May 13 21:41:07 --- last message repeated 5 times ---
info: [IOS_SYSLOG_ROW ] May 13 21:41:07 Apples-MacBook-Pro com.apple.CoreSimulator.SimDevice.5FB5E4B8-830A-4C71-9F3F-E3E05BEC43EF.launchd_sim8127: Service exited due to signal: Killed: 9
info: [debug] [INST] 2015-05-13 16:11:07 +0000 Error: Error during eval: scrollToVisible@[native code]
eval code
eval@[native code]
startProcessing@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/0092E98D-7AEA-4380-8A72-28A90D3080A4/bootstrap-931e8d7703a594e3.js:2693:30
bootstrap@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/0092E98D-7AEA-4380-8A72-28A90D3080A4/bootstrap-931e8d7703a594e3.js:2761:31
global code@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/0092E98D-7AEA-4380-8A72-28A90D3080A4/bootstrap-931e8d7703a594e3.js:2770:10
info: [debug] [INST] 2015-05-13 16:11:07 +0000 Debug: responding with:
2015-05-13 16:11:07 +0000 Debug: Running system command #11: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":17,"value":"target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()["S...
info: [debug] [INST STDERR] 2015-05-13 21:41:07.972 instruments[8880:539327] Attempting to set event horizon when core is not engaged, request ignored
info: [IOS_SYSLOG_ROW ] May 13 21:41:07 Apples-MacBook-Pro.local SpringBoard[8141]: Application 'UIKitApplication:com.example.apple-samplecode.UICatalog[0xe9e2]' exited abnormally via signal.
info: [IOS_SYSLOG_ROW ] May 13 21:41:07 Apples-MacBook-Pro.local assertiond[8145]: notify_suspend_pid() failed with error 7
info: [IOS_SYSLOG_ROW ] May 13 21:41:07 Apples-MacBook-Pro assertiond[8145]: assertion failed: 14D136 12F69: assertiond + 12334 [8E465C14-E4AE-36E9-AFBE-D28459602962]: 0x1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions