我正在这样配置appium:
AppiumDriverLocalService service = new AppiumServiceBuilder()
.withAppiumJS(
new File("//usr//local//lib//node_modules//appium//build//lib//main.js"))
.withIPAddress("127.0.0.1")
.usingPort(4723)
.build();
但是当我运行时出现此错误:
[Appium] 'npm' executable is not found neither in the process working folder (/Users/.../eclipse-workspace/Appium) nor in any folders specified in the PATH environment variable (/usr/bin:/bin:/usr/sbin:/sbin).
Node 和 NPM 已安装,并且我已检查版本。
我的路径:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_HOME=/Users/<..>/Library/Android/sdk
export MAVEN_HOME=/opt/homebrew/Cellar/maven/3.9.4/libexec
export PATH=$PATH:/usr/local/bin:/usr/local/bin/npm
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator
添加以下依赖项,因为它对我有用。
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.13.0</version>
</dependency>