• APP——自动化——java——初始化安装程序


    package jkcs;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;
    
    import org.openqa.selenium.remote.DesiredCapabilities;
    import io.appium.java_client.AppiumDriver;
    public class jblx 
    {
        public static void main(String[] args) throws MalformedURLException, InterruptedException 
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();  
    
            capabilities.setCapability("platformName", "Android");  
            capabilities.setCapability("deviceName","8DF6R17503000072");  
            capabilities.setCapability("platformVersion", "8.0.0"); 
            
            capabilities.setCapability("unicodeKeyboard","True");
            capabilities.setCapability("resetKeyboard","True");
            
            capabilities.setCapability("autoGrantPermissions", "True");  
            
            capabilities.setCapability("app", "C:\Users\del\Desktop\b\jsq.apk");  
            
            capabilities.setCapability("appPackage", "com.youba.calculate");  
            capabilities.setCapability("appActivity", "com.youba.calculate.MainActivity");  
            
            
            
            
            AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            
            
            driver.manage().timeouts().implicitlyWait(500, TimeUnit.SECONDS);
            
            
            Thread.sleep(5000);
            
            System.out.println(driver.currentActivity());
            
            Thread.sleep(5000);
                  
            System.out.println(driver.getCapabilities());
            
            Thread.sleep(5000);
    
            driver.quit();
        }
    }

    执行结果:

    .MainActivity
    Capabilities [{appPackage=com.youba.calculate, statBarHeight=84, viewportRect={top=84, left=0, width=1440, height=2344}, deviceName=8DF6R17503000072, platform=LINUX, deviceUDID=8DF6R17503000072, desired={app=C:UsersdelDesktopjsq.apk, appPackage=com.youba.calculate, appActivity=com.youba.calculate.MainActivity, platformVersion=8.0.0, autoGrantPermissions=true, unicodeKeyboard=true, platformName=Android, deviceName=8DF6R17503000072, resetKeyboard=true}, platformVersion=8.0.0, webStorageEnabled=false, takesScreenshot=true, javascriptEnabled=true, unicodeKeyboard=true, platformName=Android, deviceApiLevel=26, deviceManufacturer=HUAWEI, resetKeyboard=true, app=C:UsersdelDesktopjsq.apk, deviceScreenSize=1440x2560, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, appActivity=com.youba.calculate.MainActivity, pixelRatio=3.5, locationContextEnabled=false, autoGrantPermissions=true, deviceScreenDensity=560, deviceModel=EDI-AL10}]

  • 相关阅读:
    提高ASP.NET效率的几个方面
    危险字符过滤的类
    通过HttpModule实现数据库防注入
    字符串(含有汉字)转化为16进制编码进制
    C# 中的类型转换
    防范SQL注入攻击的代码
    微软笔试小感
    Debug和Trace配置小记
    C#动态地调用Win32 DLL中导出的函数
    Debug和Trace使用小记
  • 原文地址:https://www.cnblogs.com/xiaobaibailongma/p/13196017.html
Copyright © 2020-2023  润新知