• APP——java——自动化环境搭建02——个人详细搭建——夜神模拟


    接上文:

    安装完成后要进行一下简单修改:

    (1)、打开安装目录,进入到bin目录(比如:D:Noxin)
    (2)、把安装好的Android SDK里的adb.exe文件(比如我的在D:AndroidSDKplatform-tools目录下)复制到该目录覆盖掉该目录已存在的adb.exe文件
    (3)、删掉该目录的nox_adb.exe文件,再复制一份adb.exe并重命名为nox_adb.exe
    (4)、启动模拟器

    ===========================================================================

    确认夜神模拟器是否启动成功:

    ================================================================================

    package jkcs;
    
    import java.net.MalformedURLException;
    import java.net.URL;
    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","127.0.0.1:62001");  
            capabilities.setCapability("platformVersion", "5.1.1");  
     
            capabilities.setCapability("appPackage", "com.youdao.calculator");  
            capabilities.setCapability("appActivity", "com.youdao.calculator.activities.MainActivity");  
            
            AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            
            Thread.sleep(5000);
            System.out.println(driver.currentActivity());
            Thread.sleep(5000);
            System.out.println(driver.getCapabilities());
            Thread.sleep(5000);
            driver.quit();
        }
    }

    执行结果:

    .activities.GuideActivity


    Capabilities [{appPackage=com.youdao.calculator, deviceScreenSize=720x1280, networkConnectionEnabled=true, statBarHeight=38, warnings={}, viewportRect={top=38, left=0, width=720, height=1242}, databaseEnabled=false,

    deviceName=127.0.0.1:62001,

    platform=LINUX,

    deviceUDID=127.0.0.1:62001,

    appActivity=com.youdao.calculator.activities.MainActivity,

    desired={appPackage=com.youdao.calculator,

    appActivity=com.youdao.calculator.activities.MainActivity,

    platformVersion=5.1.1,

    platformName=Android,

    deviceName=127.0.0.1:62001},

    platformVersion=5.1.1,

    pixelRatio=1.5,

    webStorageEnabled=false,

    locationContextEnabled=false,

    takesScreenshot=true,

    javascriptEnabled=true,

    deviceScreenDensity=240,

    deviceModel=MI 9,

    platformName=Android,

    deviceApiLevel=22,

    deviceManufacturer=Xiaomi

    }]

  • 相关阅读:
    ThinkPHP中pathinfo模式与URL重写
    JS分割字符串并放入数组的函数
    js解决弹窗问题实现班级跳转DIV示例
    javascript客户端遍历控件与获取父容器对象
    Apache 虚拟目录和默认首页的设置
    linux Apache CGI 安装配置
    apache与和mysql重启命令
    带你从零学ReactNative开发跨平台App开发(三)
    带你从零学ReactNative开发跨平台App开发(一)
    C#/Net定时导出Excel并定时发送到邮箱
  • 原文地址:https://www.cnblogs.com/xiaobaibailongma/p/13114496.html
Copyright © 2020-2023  润新知