I'm using Appium version 1.5.1
in Mac OS
. I want to change appium configuration when it is installed by npm command (npm install -g appium
) not by the .dmg application. Is there a way to change it like changing the device name, command timeout, platform version ... ? Thanks.
我在Mac OS中使用Appium 1.5.1版。我想通过npm命令(npm install -g appium)而不是.dmg应用程序安装appium配置。有没有办法改变它,如更改设备名称,命令超时,平台版本......?谢谢。
2 个解决方案
#1
2
In 1.4.13, if u use dmg the path was
在1.4.13中,如果你使用dmg路径是
/Applications/Appium.app/Contents/resources
but after install 1.5.1 using node, the path is
但是在使用node安装1.5.1之后,路径就是
/usr/local/lib/node_modules/appium/
i also have installed 1.5.1 using node and i also have previously installed 1.4.13 using dmg. In my case the problem was
我也安装了1.5.1使用节点,我之前也使用dmg安装了1.4.13。就我而言,问题是
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iOS");
i just comented this capability for when i run 1.5.1 by using command
我刚刚通过使用命令运行1.5.1时为此功能注释了一下
appium
I use the 1.4.13 inspector to inspect(don't launch the appium 1.4.13), just click on inspector of it.
我使用1.4.13检查器进行检查(不要启动appium 1.4.13),只需单击它的检查器即可。
I also change this two line when i run my java code through command line in version 1.5.1
当我在1.5.1版中通过命令行运行我的java代码时,我也改变了这两行
CommandLine command = new CommandLine("/usr/local/bin/node");
command.addArgument("/usr/local/lib/node_modules/appium/build/lib/main.js", false);
In 1.5.1, instead of
在1.5.1中,而不是
driver.findElementByname(), use driver.findElementByAccessibilityId().
however, i set appium ios capabilities like below
但是,我设置了appium ios功能,如下所示
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPad 2");
capabilities.setCapability(MobileCapabilityType.VERSION, "7.2");
capabilities.setCapability(MobileCapabilityType.PLATFORM,"Mac");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("sendKeyStrategy","setValue");
capabilities.setCapability("--no-reset", false);
driver = new IOSDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
#2
0
Finally i change the default configuration for appium by this way :
最后,我通过这种方式更改appium的默认配置:
appium --default-capabilities '{"app":"safari","browserName":"safari","appium-version":"1.5.1","platformName":"iOS","platformVersion":"9.3","deviceName":"iPad Air","nativeInstrumentsLib":true}' --command-timeout "0" --pre-launch --nodeconfig "/Users/me/nodeconfig.json" --launch-timeout "180000"
appium --default-capabilities'{“app”:“safari”,“browserName”:“safari”,“appium-version”:“1.5.1”,“platformName”:“iOS”,“platformVersion”:“9.3 “,”deviceName“:”iPad Air“,”nativeInstrumentsLib“:true}' - command-timeout”0“--pre-launch --nodeconfig”/Users/me/nodeconfig.json“--launch-timeout” 180000"
#1
2
In 1.4.13, if u use dmg the path was
在1.4.13中,如果你使用dmg路径是
/Applications/Appium.app/Contents/resources
but after install 1.5.1 using node, the path is
但是在使用node安装1.5.1之后,路径就是
/usr/local/lib/node_modules/appium/
i also have installed 1.5.1 using node and i also have previously installed 1.4.13 using dmg. In my case the problem was
我也安装了1.5.1使用节点,我之前也使用dmg安装了1.4.13。就我而言,问题是
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iOS");
i just comented this capability for when i run 1.5.1 by using command
我刚刚通过使用命令运行1.5.1时为此功能注释了一下
appium
I use the 1.4.13 inspector to inspect(don't launch the appium 1.4.13), just click on inspector of it.
我使用1.4.13检查器进行检查(不要启动appium 1.4.13),只需单击它的检查器即可。
I also change this two line when i run my java code through command line in version 1.5.1
当我在1.5.1版中通过命令行运行我的java代码时,我也改变了这两行
CommandLine command = new CommandLine("/usr/local/bin/node");
command.addArgument("/usr/local/lib/node_modules/appium/build/lib/main.js", false);
In 1.5.1, instead of
在1.5.1中,而不是
driver.findElementByname(), use driver.findElementByAccessibilityId().
however, i set appium ios capabilities like below
但是,我设置了appium ios功能,如下所示
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPad 2");
capabilities.setCapability(MobileCapabilityType.VERSION, "7.2");
capabilities.setCapability(MobileCapabilityType.PLATFORM,"Mac");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("sendKeyStrategy","setValue");
capabilities.setCapability("--no-reset", false);
driver = new IOSDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
#2
0
Finally i change the default configuration for appium by this way :
最后,我通过这种方式更改appium的默认配置:
appium --default-capabilities '{"app":"safari","browserName":"safari","appium-version":"1.5.1","platformName":"iOS","platformVersion":"9.3","deviceName":"iPad Air","nativeInstrumentsLib":true}' --command-timeout "0" --pre-launch --nodeconfig "/Users/me/nodeconfig.json" --launch-timeout "180000"
appium --default-capabilities'{“app”:“safari”,“browserName”:“safari”,“appium-version”:“1.5.1”,“platformName”:“iOS”,“platformVersion”:“9.3 “,”deviceName“:”iPad Air“,”nativeInstrumentsLib“:true}' - command-timeout”0“--pre-launch --nodeconfig”/Users/me/nodeconfig.json“--launch-timeout” 180000"