Appium Driver selects the wrong value in Android Spinner - android-spinner

The spinner has values(1 to 10).
Code is set to select 2, but 1 is selected.
#AndroidFindBy(id = "quantity_spinner")
private AndroidElement spinnerQuantity;
public void setQuantity(String val){
spinnerQuantity.click();
driver.findElementByXPath("//android.widget.TextView[#text='"+val+"']").click();
}
//function call
setQuantity('2');
Appium Version 1.4.1 on Samsung 7

Pass the value as string and not character. In your code it should be "2" and not '2'. Also update Appium to latest stable version

Related

how to control exoplayer pip via switch button

i want to control pip mode via switch if user press the switch button to disable pip mode the code i wrote in userleaveagent for pip wont work and if they enable it will work. similar to google android youtube feature
i can provide what i have. currenly i have added pip mode via userleaveagent trigger
private void pipcode() {
Display d = getWindowManager()
.getDefaultDisplay();
Point p = new Point();
d.getSize(p);
int width = p.x;
int height = p.y;
Rational ratio
= new Rational(2, 3);
PictureInPictureParams.Builder
pip_Builder
= new PictureInPictureParams
.Builder();
pip_Builder.setAspectRatio(ratio).build();
enterPictureInPictureMode(pip_Builder.build());
setPictureInPictureParams(new PictureInPictureParams.Builder()
.setSeamlessResizeEnabled(false)
.build());
}

How to get a subString prior iOS 10?

In swift,I can use subSting() method to get a subString like this:
let sessionId = "this is a test"
let index = sessionId.index(sessionId.startIndex, offsetBy: 2)
let prefix = sessionId.substring(to: index)
But,today I found the method'availability is iOS 10 and later.How to handle this problem for you guys?
Availability iOS (10.0 and later), macOS (10.12 and later), tvOS (10.0 and later), watchOS (3.0 and later)

CodenameOne - Layered Layout import not working

According to the docu of LayeredLayout here (JavaDoc), there is an inset method that can be used for relative positioning. I created a bare pones CN1 project and added this piece, also from the docu:
Container cnt = new Container(new LayeredLayout());
LayeredLayout ll = (LayeredLayout)cnt.getLayout();
TextField searchField = new TextField();
Button btn = new Button("Search");
cnt.add(searchField).add(btn);
ll
.setInsets(searchField, "1mm auto auto auto")
.setInsets(btn, "0 auto auto 0")
.setReferenceComponentLeft(btn, searchField, 1f)
.setReferenceComponentTop(btn, searchField, 0);
However, I am getting an error that the setInset Method is not found. Looking at the source of LayeredLayout class reveals that it indeed does not have this method.
The method setInsets(TextField, String) is undefined for the type LayeredLayout
I just updated CN1 lib to the latest version as of today.
Any idea?
I suggest updating your plugin.
In Codename One Settings select Basic and click Update Client Libs.

Find object button In Xamarin IOS

I am new in IOS and using websync tech to sync data and keep update price button, but how can I find the object button in IOS? In Android it can use findbyId function, Isn't got any solution? I using this setValueForKey function but always get error.
Name: NSUnknownKeyException Reason: [<SA_IOS_MatchScreen 0x7fab255c4730> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key TG01.
I think you can use ViewWithTag! Just remember set tag value.
Then you can use tag to find your button.
I tried it and it works!
* Don't set tag = 0 because it's default value is 0;
UIButton btn1 = this.View.ViewWithTag(1) as UIButton;
btn1.Enabled = false;
btn1.SetTitle("Change!",UIControlState.Normal);

How get fonts installed or supportd in mobile using getProperty - java me

Hope you all will be fine. Can any one tell me how can i get the fonts installed or supported in the mobile. And suppose urdu font supported by the mobile then i set a condition like this.
[code]
import java.lang.*;
String value;
String key = "microedition.font"; // not real need value it's just to show what i want
value = System.getProperty( key );
If (value == urdu){
txtArea2.getStyle.setFont(value);
} else {
System.out.println("Urdu not supported);
}
[/code]
is it possible to do something like this.
Thank you.
MIDP 2.x defines 3 faces of font with 3 sizes + 3 styles.
FACE_MONOSPACE
FACE_PROPORTIONAL
FACE_SYSTEM
SIZE_LARGE
SIZE_MEDIUM
SIZE_SMALL
STYLE_BOLD
STYLE_ITALIC
STYLE_UNDERLINED
You can choose font by using these values as like the below code:
Font f = Font.getFont(FACE_SYSTEM | SIZE_MEDIUM | STYLE_ITALIC);
From MIDP 3.0, you can assign font name with installed font or downloaded font. as like:
Font[] f = Font.getAvailableFonts(); // Get available fonts
Font a = Font.getFont("Andale Mono", STYLE_ITALIC, 10); // Get specific font
Unfortunately, there is no development tools for MIDP3 now.

Resources