Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auto-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄承天
auto-test
Commits
dba76e58
提交
dba76e58
authored
3月 30, 2020
作者:
黄承天
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正截图资源路径
上级
e65c8c07
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
9 行删除
+19
-9
SeleniumExecutor.java
...java/com/zjty/autotest/service/impl/SeleniumExecutor.java
+13
-4
application.properties
src/main/resources/application.properties
+6
-5
没有找到文件。
src/main/java/com/zjty/autotest/service/impl/SeleniumExecutor.java
浏览文件 @
dba76e58
...
...
@@ -45,6 +45,9 @@ public class SeleniumExecutor {
@Value
(
"${selenium.executor.wait-after-click}"
)
private
Long
waitTime
;
@Value
(
"${screenshot-path}"
)
private
String
screenshotPath
;
@Value
(
"${selenium.executor.screenshot.url-host}"
)
private
String
screenshotPrefixHost
;
...
...
@@ -139,9 +142,9 @@ public class SeleniumExecutor {
//如果出错 则提供截图
String
screenshot
=
null
;
if
(!
success
)
{
String
screenshotName
=
alterUrlName
(
currentUrl
);
String
screenshotName
=
alterUrlName
(
currentUrl
)
+
".png"
;
screenshot
(
screenshotName
);
screenshot
=
String
.
format
(
"http://%s:%s/
screenshots/
%s"
,
screenshotPrefixHost
,
screenshotPrefixPort
,
screenshotName
);
screenshot
=
String
.
format
(
"http://%s:%s/%s"
,
screenshotPrefixHost
,
screenshotPrefixPort
,
screenshotName
);
}
//总合信息
Set
<
String
>
messages
=
elementDetails
.
stream
()
...
...
@@ -389,7 +392,13 @@ public class SeleniumExecutor {
private
void
screenshot
(
String
name
)
{
byte
[]
bytes
=
((
TakesScreenshot
)
driver
).
getScreenshotAs
(
OutputType
.
BYTES
);
FileUtil
.
output
(
bytes
,
FileUtil
.
WORK_PATH
+
"screenshots\\"
+
name
+
".png"
);
String
path
;
if
(
screenshotPath
.
endsWith
(
"/"
))
{
path
=
screenshotPath
+
name
;
}
else
{
path
=
screenshotPath
+
"/"
+
name
;
}
FileUtil
.
output
(
bytes
,
path
);
}
private
Boolean
elementMatch
(
WebElement
webElement
,
Element
element
)
{
...
...
@@ -430,7 +439,7 @@ public class SeleniumExecutor {
private
String
checkJsError
()
{
try
{
return
analyseLogError
(
driver
.
manage
().
logs
().
get
(
LogType
.
BROWSER
).
getAll
().
stream
().
findFirst
().
get
());
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
return
null
;
}
}
...
...
src/main/resources/application.properties
浏览文件 @
dba76e58
...
...
@@ -8,7 +8,8 @@ spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform
=
org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql
=
false
spring.resources.static-locations
=
classpath:/adapter/
spring.mvc.static-path-pattern
=
/**
spring.resources.static-locations
=
classpath:/adapter/,file:${screenshot-path}
uploadFile
=
E:/opt/auto/test/zr/
uploadUnFile
=
E:/opt/auto/test/un/
...
...
@@ -17,9 +18,10 @@ spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size
=
500MB
# Selenium\u00FF\uFFFD\u03B5\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0135\u0234\uFFFD\u02B1\uFFFD\u48E8\uFFFD\uFFFD\uFFFD\uB8E9\uFFFD\uFFFD0\u03AA\uFFFD\uFFFD\uFFFD\u0234\uFFFD\uFFFD\uFFFD
screenshot-path
=
C:/MyProjects/auto-test/src/main/resources/screenshots/
selenium.executor.wait-after-click
=
6
# Selenium\uFFFD\u1E69\uFFFD\uFFFD\u037CURL\uFFFD\u0135\uFFFD\u05B7\u01F0\u05FA\uFFFD\uFFFDip\uFFFD\uFFFD
selenium.executor.screenshot.url-host
=
localhost
# Selenium\uFFFD\u1E69\uFFFD\uFFFD\u037CURL\uFFFD\u0135\uFFFD\u05B7\u01F0\u05FA\uFFFD\uFFFDip\uFFFD\uFFFD
selenium.executor.screenshot.url-port
=
13500
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论