I am working in Windows application automation. I am using winapp driver tool.
I want to run every machine to this respective code without make any changes .
here in this line capabilities.setCapability("app", "C:\Users\Pooja\AppData\Local\Apps\2.0\HONMQK9H.9MB\MQ0TMZNT.MGW\data..tion_6e5be371fe594b2d_0006.0001_842b5c92335cdaae"); This is application . My application is loading from this . here this is my username as Pooja. But every machine have different different user. so How to better way to do this ,so I can put my code into bitbucket, then every person in my company can use my code, without make any changes

Here is mycode :

public class BaseBallTest {

    private static WindowsDriver<WindowsElement> driver;

    public static void main(String args[]) throws MalformedURLException, InterruptedException {

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("app", "C:\Users\Pooja\AppData\Local\Apps\2.0\HONMQK9H.9MB\MQ0TMZNT.MGW\data..tion_6e5be371fe594b2d_0006.0001_842b5c92335cdaae");
        WindowsDriver Session = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities);

        Assert.assertNotNull(Session);
        Session.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

        Session.findElementByName("OK").click();


        DesiredCapabilities Appcapabilities = new DesiredCapabilities();
        Appcapabilities.setCapability("app", "Root");
        WindowsDriver AppSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), Appcapabilities);
        Thread.sleep(5000);

        WebDriverWait wait=new WebDriverWait(AppSession, 30);
        AppSession.findElementByAccessibilityId("Txtusername").sendKeys("r_abhis");
        AppSession.findElementByAccessibilityId("TxtPassword").sendKeys("abhishek");
        AppSession.findElementByAccessibilityId("btnLogin").click();
    }



}

These are the 3 different ‘s location file..

C:\Users\Kaveri\AppData\Local\Apps\2.0\LG9JWX14.O3Z\ZYE4VGQL.B3O\stat..tion_6e5be371fe594b2d_0001.0000_65d627285afa285a\STATS.SoccerDataCollection.exe


C:UsersNathanAppDataLocalApps2.0L0JYPG9R.ACOVDKJ9TZZ.T28stat..tion_6e5be371fe594b2d_0001.0000_65d627285afa285aSTATS.SoccerDataCollection.exe

C:UsersAntonyAppDataLocalApps2.0HHCZT7OJ.D3761K3K288.OXHstat..tion_6e5be371fe594b2d_0001.0000_65d627285afa285aSTATS.SoccerDataCollection.exe

C:UsersAntonyAppDataLocalApps2.0HHCZT7OJ.D3761K3K288.OXH — until these path is different from every pc…so how to take thes loaction ?

LOCALAPPDATA=C:UsersJoeAppDataLocal        I need to read 3 more folders.. how do i read ?



Source link https://sqa.stackexchange.com/questions/34757/what-is-the-better-way-to--the-location-path-from-pc

LEAVE A REPLY

Please enter your comment!
Please enter your name here