使用 PHPUnit 在 Selenium 中发现错误(线程 "main" java.lang.UnsupportedClassVersionError 中的异常)

Error Found (Exception in thread "main" java.lang.UnsupportedClassVersionError) in Selenium With PHPUnit

我正在尝试使用 PHPUnit 设置 Selenium 以进行自动化测试,但是当我想使用此命令执行 jar 文件时

java -jar /usr/local/bin/selenium-server-standalone-2.53.0.jar " 

显示此错误:

我该如何解决这个问题?请帮忙。

基于 changelog, selenium requires Java 7 (1.7) or 8 (1.8) since release 2.47, while the screenshot you posted shows version 6 (1.6). So either you need to install Java to 7 or 8, or make it default, if it's already installed. Since it appears that you are on MacBook-Pro, check the following instructions: How do I install Java for my Mac?. If java 7 or 8 already installed, check this page 如何将其设置为默认值。