# Failing to Set PickerWheel Value

**URL:** <https://discuss.appium.io/t/failing-to-set-pickerwheel-value/18059>\
**Category:** Support\
**Created:** [August 4, 2017, 4:04pm UTC](https://discuss.appium.io/t/failing-to-set-pickerwheel-value/18059 "2017-08-04T16:04:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrunoAlva](https://discuss.appium.io/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@BrunoAlva](https://discuss.appium.io/u/BrunoAlva)\
**Post date:** [August 4, 2017, 4:04pm UTC](https://discuss.appium.io/t/failing-to-set-pickerwheel-value/18059/1 "2017-08-04T16:04:34Z")

</div>

Hi Everyone!

I’ve been having trouble with setting the value of a PickerWheel in iOS/XCUI. Even though I’m using sendKeys() and setValue(), nothing happens. I don’t know if it may be because I’m casting my driver as an IOSDriver from an originally AppiumDriver and because of that setValue() may not work correctly???..

Anyway, I read Appium’s logs and found these pretty interesting, but still don’t know what to do. I wish to select the value “Stage/Env5” and when I call sendKeys and setValue methods like this:

`pickerElement.setValue("Stage/Env5");`

Or like this:

`pickerElement.sendKeys("Stage/Env5");`

Appium’s Logs send me this:

Logs:

> [2017-08-04 10:24:40][HTTP] → POST /wd/hub/session/b70cb12b-c2c7-4ad4-a263-800b1da07fcf/appium/element/998EA423-4E70-4D20-B720-7E72DCB3EEA2/value {“id”:“998EA423-4E70-4D20-B720-7E72DCB3EEA2”,“value”:“Stage/Env5”}  
> [2017-08-04 10:24:40][MJSONWP] Calling AppiumDriver.setValueImmediate() with args: [“Stage/Env5”,“998EA423-4E70-4D20-B720-7E72DCB3EEA2”,“b70cb12b-c2c7-4ad4-a263-800b1da07fcf”]  
> [2017-08-04 10:24:40][XCUITest] Executing command ‘setValueImmediate’  
> [2017-08-04 10:24:40][XCUITest] There is currently no way to bypass typing using XCUITest. Setting value through keyboard  
> [2017-08-04 10:24:40][JSONWP Proxy] Proxying [POST /element/998EA423-4E70-4D20-B720-7E72DCB3EEA2/value] to [POST [http://localhost:8100/session/47097191-8B6C-4443-BBC7-166F2CC8D1AA/element/998EA423-4E70-4D20-B720-7E72DCB3EEA2/value](http://localhost:8100/session/47097191-8B6C-4443-BBC7-166F2CC8D1AA/element/998EA423-4E70-4D20-B720-7E72DCB3EEA2/value)] with body: {“value”:[“S”,“t”,“a”,“g”,“e”,“/”,“E”,“n”,“v”,“5”]}  
> [2017-08-04 10:24:41][iOSLog] [IOS\_SYSLOG\_ROW] Aug 4 10:24:39 AMAC02NX7BDG085 testmanagerd[2139]: \*\*\* LOG MESSAGE QUOTA EXCEEDED - SOME MESSAGES FROM THIS PROCESS HAVE BEEN DISCARDED \*\*\*  
> [2017-08-04 10:24:42][iOSLog] [IOS\_SYSLOG\_ROW] Aug 4 10:24:40 AMAC02NX7BDG085 XCTRunner[2143]: Enqueue Failure: Internal error: unable to find current value ‘default, 3 of 6’ in possible values Latest/Env5, Latest/Env2, default, UAT1 (Finder only), Stage/Env2, Stage/Env5 for the picker wheel “default, 3 of 6” PickerWheel /Applications/Appium.app/Contents/Resources/app/node\_modules/appium/node\_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 35 1  
> [2017-08-04 10:24:42][iOSLog] [IOS\_SYSLOG\_ROW] Aug 4 10:24:40 AMAC02NX7BDG085 XCTRunner[2143]: Enqueue Failure: Failed to receive event delivery confirmation within 0.0s of the original dispatch. /Applications/Appium.app/Contents/Resources/app/node\_modules/appium/node\_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 35 1  
> [2017-08-04 10:24:42][JSONWP Proxy] Got response with status 200: {“value”:{},“sessionId”:“47097191-8B6C-4443-BBC7-166F2CC8D1AA”,“status”:0}  
> [2017-08-04 10:24:42][MJSONWP] Responding to client with driver.setValueImmediate() result: null  
> [2017-08-04 10:24:42][HTTP] ← POST /wd/hub/session/b70cb12b-c2c7-4ad4-a263-800b1da07fcf/appium/element/998EA423-4E70-4D20-B720-7E72DCB3EEA2/value 200 1619 ms - 76

I don’t know how to take these logs, but I’m pretty new to Appium.

Another thing that I think may be causing this is that, PickerWheel’s available values are the ones that I can read in the Logs, but when I inspect the screen, the setted value is different, its showed as this:

> “_nameOfValue_, _indexOfValue_ of _totalNumberOfValues_”

Instead of the value itself by its own. I also have some pictures:  
 ![image](https://discuss.appium.io/uploads/default/original/2X/a/a8f474778e6f3203a7799034c0ff8263c2866b17.jpg)

 ![image](https://discuss.appium.io/uploads/default/original/2X/9/936442c74d42942e356ddcaa808824d21f6dcdf6.png)

I hope you guys can help 'cause I’ve tried everything I can, and searched through Google but haven’t found a solution in the related issues.

Thanks!

---

<div class="post-metadata">

**Author:** ![SireeshaSimakurthy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@SireeshaSimakurthy](https://discuss.appium.io/u/SireeshaSimakurthy)\
**Post date:** [August 10, 2017, 7:29pm UTC](https://discuss.appium.io/t/failing-to-set-pickerwheel-value/18059/2 "2017-08-10T19:29:03Z")

</div>

@BrunoAlva, I had a similar issue with PickerWheels and used JavaScript executor + Mobile Gestures to resolve the issue. Below if the function I am using as a workaround. Hope this will resolve your issue too

public static boolean Select\_Required\_Value\_From\_PickerWheel(String ByClassName\_ToFindChildrenInPicker, String ExpectedElementToSelect, int PickerWheelIndex) {  
//Initialize return variable  
boolean bln\_ExpectedElementToSelect = false;

```
	try {
		//Get PickerWheel Item
		List<MobileElement> wheels = appiumDriver.findElements(MobileBy.className("XCUIElementTypePickerWheel"));
		int WheelListSize = wheels.get(PickerWheelIndex).findElements(By.className(ByClassName_ToFindChildrenInPicker)).size();
		
		for (int i = 0; i < WheelListSize; i++) {
			
			//Read the selected value
			String strPickerWheelSelectedValue = wheels.get(PickerWheelIndex).getText();
			if (strPickerWheelSelectedValue.contains(ExpectedElementToSelect)){
				bln_ExpectedElementToSelect = true;
				break;
			}
			
			//Navigate to next item in the list
			JavascriptExecutor js = (JavascriptExecutor) appiumDriver;
			Map<String, Object> params = new HashMap<>();
			params.put("order", "next");
			params.put("offset", 0.15);
			params.put("element", ((RemoteWebElement) wheels.get(PickerWheelIndex)).getId());
			js.executeScript("mobile: selectPickerWheelValue", params);
		}
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	//Return value
	return bln_ExpectedElementToSelect;
}
```

---

<div class="post-metadata">

**Author:** ![vas](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/ac91a4/32.png) [@vas](https://discuss.appium.io/u/vas)\
**Post date:** [October 25, 2017, 7:13pm UTC](https://discuss.appium.io/t/failing-to-set-pickerwheel-value/18059/3 "2017-10-25T19:13:08Z")

</div>

Thanks much for sharing code. struggling to resolve this issue & got solution.  
Though it takes much time to get pickerwheel size & to select required option, tests are executing successfully.  
not sure why .sendkey() are not working to pick values from picker wheel.
