Selenium/winapp driver reading data from property file

时间:2018-07-24 10:14:42

标签: java

I'm trying to automate through winapp driver, where I'm keeping coordinates in config file and created method where I can read that property file but I'm not able to read that values instead of values it is printing 0,0.

public static void coordinates(int point ,int x,int y) {       
    switch(point) {
        case 2 :                
            String[] xy = prop.getProperty("2_point").split(",");
            System.out.println(xy);

            int x1=Integer.valueOf (xy[0]);
            int y1=Integer.valueOf (xy[1]);
            break;          
        case 3:
            String[] xy1 = prop.getProperty("3_point").split(",");

            int x2=Integer.valueOf (xy1[0]);
            int y2=Integer.valueOf (xy1[1]);
            break;          
        case 4:
            String[] xy2 = prop.getProperty("4_point").split(",");

            int x3=Integer.valueOf (xy2[0]);
            int y3=Integer.valueOf (xy2[1]);
            break;
    }
}

I'm keeping this coordinates in config.property file:

2_point=100,160
3_point=200,200
4_point=62,199

And I'm calling that method as shown below:

Action = new Actions(AppSession);
court=AppSession.findElementByAccessibilityId("picCourt");
coordinates(point,x,y);
System.out.println(x);
System.out.println(y);

switch(point) {
    case 2 :
        action.moveToElement(court, x1, y1).click().perform();
        System.out.println(x1);
        System.out.println(y1);
        break;
    case 3:
        action.moveToElement(court, x2, y2).click().perform();
        break;
    case 4:
        action.moveToElement(court, x3, y3).click().perform();
        break;
}

But when I printed x y coordinates printing as 0,0 instead of that values which I passed in config file.

0 个答案:

没有答案