I’m trying to control slider using SetSliderValue but i failed, In my case the Object property X varies from 619 to 1433. Can i set a variable as object property so that i can change X value to (x+200) using loops.
As far as I know, you can not change (= overwrite) the value of properties of a TestObject during a TestCase running.
You can org.openqa.selenium.WebElement and org.openqa.selenium.By in Katalon Studio, over which you would have minute control. Why not you use them instead?
Your test case script can create a new instance of TestObect, which has no property defined, on the fly.
TestObject newObj = new TestObject()
You can read properties of an existing TestObject instance and copy them into your new one by addProperty(name, condition, value, active) while modifying the X property as you want.
TestObject original = findTestObject("Object Repository/foo/bar")
List<TestObjectProperty> lst = original.getActiveProperties()
for (TestObjectProperty top : lst) {
if (top.getName().equals("x")) {
// set x newObj with x property as you like
} else {
newObj.addProperty(top.getName(), top.getCondition(), top.getValue(), top.isActive())
}
}
// use newObj with new X value
It would be better to create a Custom Keyword which encloses the above “cloning TestObject” functionality.
In my case the Object property X varies from 619 to 1433.
What do you think the property ‘x’ stands for? Do you think ‘x’ represents the current position of moving slider meter?
I don’t think ‘x’ presents the position of the meter which moves horizontally. I think ‘x’ represents the (x,y) position of the upper left point of the Slider object, which is fixed, never changes.
Creating a new TestObject (which I happened to mention) is totally useless. You need to use Mobile.SetSliderValue() keyword appropriately.
My issue is like the slider i got is not seekbar, and i not sure how they defined this in app.
The Minimum value (Slider at 0% ) of ‘x’ is '617" and Maximum value (Slider at 100%) is “1433” and the Max and Minimum values varies with respect to screen resolution.
Currently i’m using android emulator and i have got the above values for “X”.