Getting Javascript Exception error while automating pickerwheel in iOS

I want to automate an pickerwheel which has values such as New (40), InProgress(50),Decline(60) . If i am using sendkeys method then its working , but the problem is that i have to give complete values in sendkeys such as Declined(50) , the number in bracket keeps on changing .
Therefore i tried with mobile:selectpickerwheel method , but while using this method i am getting Javascript Exception

Exception:
org.openqa.selenium.JavascriptException: javascript error (javascript error. Cannot parse the command: invalid parameters delimiter ‘(’ or ‘)’. e.g.: ‘seetest:client.click("", “”, …)’) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 0 milliseconds

Driver info: io.appium.java_client.ios.IOSDriver

Capabilities {app: /Users/nidhi/Desktop/NewFra…, appBuildVersion: , appReleaseVersion: , appiumVersion: 1.8.0, applicationClearData: false, autoAcceptAlerts: false, autoDismissAlerts: false, autoGrantPermissions: false, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.mindfire.Demo, commandTimeouts: 120000, desired: {app: ., automationName: XCUITest, browserName: , platformName: iOS, platformVersion: 13.0, udid: c1d7e7909e7ffa0cc6816a8d279…}, device.category: PHONE, device.majorVersion: 14, device.manufacture: Apple, device.model: iPhone 6s, device.os: iOS, device.screenSize: 750x1334, device.serialNumber: c1d7e7909e7ffa0cc6816a8d279…, device.version: 14.2, dontGoHomeOnQuit: false, dontStopAppOnReset: false, fullReset: false, install.only.for.update: false, installOnlyForUpdate: false, instrumentApp: false, javascriptEnabled: true, keystorePath: ~/.android/debug.keystore, locationServicesAuthorized: false, newSessionWaitTimeout: 600, noReset: false, platform: IOS, platformName: iOS, platformVersion: 13.0, projectName: , reportDirectory: reports, reportFormat: xml, reservationDuration: 240, takeScreenshots: true, test.type: Mobile, testName: mobile test 12/21/20 09:25 PM, udid: c1d7e7909e7ffa0cc6816a8d279…, useKeystore: false, waitForDeviceTimeout: 120000}

Please help

Try setValue instead -> http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/#ios-pickerwheels-swipe

Hi thanks for your reply . Actually in this scenario i cant use setvalue and sendkeys because in this case we have to pass same text i.e Declined (45) in script. then only it works . The number in bracket keeps on changing therefore cant use setvalue . And if i am using mobile select pickerwheel method then its giving javascript exception.
WebElement picker = driver.findElementByClassName(“XCUIElementTypePickerWheel”);
Map<String, Object> params = new HashMap<>();
params.put(“order”, “next”);
params.put(“offset”, 0.15);
params.put(“element”, ((RemoteWebElement) picker).getId());
driver.executeScript(“mobile: selectPickerWheelValue”, params);

Hoping for a reply . Thanks

  1. What problem setValue to whole text “Declined (45)”?
  2. what error?
  1. Using setvalue/sending keys
    MobileElement el = (MobileElement) driver.findElement(MobileBy.className(“XCUIElementTypePickerWheel”));
    el.setValue(“Declined (45)”);
    This is my code , if i am using this then its working . But the problem is the number in brackets keep on changing . If today it is 45 , then tomorrow it will be (50) , then same script wont work because i am sending Declined(45) and on next day if value in bracket changes then script will fail .

  2. If i use mobile pickerwheel method then there is javascript exception
    org.openqa.selenium.JavascriptException: javascript error (javascript error. Cannot parse the command: invalid parameters delimiter ‘(’ or ‘)’. e.g.: ‘seetest:client.click("", “”, …)’) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 0 milliseconds

Driver info: io.appium.java_client.ios.IOSDriver

Capabilities {app: /Users/nidhi/Desktop/NewFra…, appBuildVersion: , appReleaseVersion: , appiumVersion: 1.8.0, applicationClearData: false, autoAcceptAlerts: false, autoDismissAlerts: false, autoGrantPermissions: false, autoWebview: false, automationName: XCUITest, browserName: , bundleId: com.mindfire.Demo, commandTimeouts: 120000, desired: {app: ., automationName: XCUITest, browserName: , platformName: iOS, platformVersion: 13.0, udid: c1d7e7909e7ffa0cc6816a8d279…}, device.category: PHONE, device.majorVersion: 14, device.manufacture: Apple, device.model: iPhone 6s, device.os: iOS, device.screenSize: 750x1334, device.serialNumber: c1d7e7909e7ffa0cc6816a8d279…, device.version: 14.2, dontGoHomeOnQuit: false, dontStopAppOnReset: false, fullReset: false, install.only.for.update: false, installOnlyForUpdate: false, instrumentApp: false, javascriptEnabled: true, keystorePath: ~/.android/debug.keystore, locationServicesAuthorized: false, newSessionWaitTimeout: 600, noReset: false, platform: IOS, platformName: iOS, platformVersion: 13.0, projectName: , reportDirectory: reports, reportFormat: xml, reservationDuration: 240, takeScreenshots: true, test.type: Mobile, testName: mobile test 12/21/20 09:25 PM, udid: c1d7e7909e7ffa0cc6816a8d279…, useKeystore: false, waitForDeviceTimeout: 120000}

  1. For sendkeys/set value method to work we have to pass exact text on the pickerwheel . but in my scenario the text is declined (45) , here declined is fixed but the number in brackets will keep on changing .
  1. can you share pageSource here -> https://gist.github.com/ ?
  2. try exact code as in tutorial. e.g. you have:
params.put(“offset”, 0.15);

vs in example

params.put("offset", "0.2"); // tap offset

PS setValue can indeed do not work. it is pure XCUITest problem and if it does not work = nothing can be done. setValue works mostly with simple wheels per mine experience and i mention it in tutorial.

MobileElement pickerWheel =
(MobileElement) driver.findElement(MobileBy.className(“XCUIElementTypePickerWheel”));
HashMap<String, Object> params = new HashMap<>();
params.put(“order”, “next”);
params.put(“offset”, “0.2”); // tap offset
params.put(“element”, pickerWheel.getId()); // pickerWheel element

Used this . Still getting Javascript exception . I tried every possible solution but no luck

if error is same ->

= problem in code.

I have given you the code in the example . can you please tell what can be the problem . I am stuck in this problem

lets start from beginning.

  1. why 1.8.0 from April 2018 ? move to latest first.
  2. what is your java-client version? move to latest also

// https://mvnrepository.com/artifact/io.appium/java-client
compile group: ‘io.appium’, name: ‘java-client’, version: ‘7.3.0’
1.My java client version is 7.3.0
2. I am using appium studio from experitest , latest version 20.11

  1. appium studio is not Appium product. correct forum -> https://appium.experitest.com/
  2. appium version 1.8.0 is too old. your device under test has ios 13.0 which issued 7 months later.

I am able to automate now . I created xpath that fetches the text of the pickerwheel elements and then pass these values in a set value method of automating pickerwheel .
Its working for me now . Thanks Aleksei for listening my problem . Much Appreciate . Thanks .

Nice. Than is why I asked for page source to see actual values needed to set. Visual values can differ.

1 Like