Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium 更换弹簧护套上的端口_Selenium_Spring Boot - Fatal编程技术网

Selenium 更换弹簧护套上的端口

Selenium 更换弹簧护套上的端口,selenium,spring-boot,Selenium,Spring Boot,我试图通过编写以下代码来更改spring boot中使用的端口 但应用程序并没有改变端口 2017年7月13日下午7:20:18 org.openqa.selenium.safari.SafariDriverServer启动信息:服务器 于港口38002 2017年7月13日下午7:20:18开始 org.openqa.selenium.safari.SafariDriverCommandExecutor启动信息: 发射狩猎 我必须做什么才能激活此代码 尝试使用位于src/main/resour

我试图通过编写以下代码来更改spring boot中使用的端口

但应用程序并没有改变端口 2017年7月13日下午7:20:18 org.openqa.selenium.safari.SafariDriverServer启动信息:服务器 于港口38002 2017年7月13日下午7:20:18开始 org.openqa.selenium.safari.SafariDriverCommandExecutor启动信息: 发射狩猎

我必须做什么才能激活此代码


尝试使用位于
src/main/resources的
application.properties
文件设置服务器端口

server.port=9000

在Spring Boot中设置服务器端口有多种方法

1) 在
src/main/resources
中的
application.properties
中设置它:
server.port=8888

2) 在application.yaml中:

服务器:
端口:8888

3) 动态作为系统属性:
system.setProperty(“server.port”,80)

4) 引导应用程序时,例如
-Dserver.port=8888

5) 出于测试目的(我看到您添加了标记selenium,我想您希望在此应用程序上运行一些测试),您需要向测试类添加注释:

@SpringBootTest(webEnvironment=SpringBootTest.webEnvironment.DEFINED\u PORT)
@TestPropertySource(properties=“server.port=8888”)

server.port=9000