Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Vue-WebDriver
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高源
Vue-WebDriver
Commits
67a54b02
Commit
67a54b02
authored
Nov 17, 2023
by
高源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdkjs文件更新
parent
7d24de1b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
18 deletions
+34
-18
collectionTable.vue
src/components/collectionTable.vue
+0
-0
loopClick.vue
src/components/loopClick.vue
+2
-2
sdk.js
src/sdk.js
+32
-16
No files found.
src/components/collectionTable.vue
View file @
67a54b02
This diff is collapsed.
Click to expand it.
src/components/loopClick.vue
View file @
67a54b02
...
...
@@ -17,7 +17,7 @@
</template>
<
script
>
import
{
tableInfo
,
getTableData
}
from
'../sdk'
import
{
getTableData
}
from
'../sdk'
export
default
{
name
:
'loopClick'
,
components
:
{},
...
...
@@ -29,7 +29,7 @@ export default {
}
},
created
()
{
console
.
log
(
tableInfo
)
//表格展示配置
let
_this
=
this
_this
.
tableData
=
getTableData
()
...
...
src/sdk.js
View file @
67a54b02
var
tableInfo
=
{
sameXpath
:
""
,
Xpaths
:
[],
subTagets
:
[]
}
// 返回table数据
function
getTableData
(
params
)
{
// 返回table数据 传入选择的xpaths
function
getTableData
(
Xpaths
)
{
console
.
log
(
'这是table界面'
)
// 最后返回结果
let
foundElements
=
[]
let
transformedData
=
[]
let
commonPathResults
=
processXPaths
(
Xpaths
)
// 找出相同的path
let
commonPathResults
=
processXPaths
(
tableInfo
.
Xpaths
)
tableInfo
.
sameXpath
=
commonPathResults
.
commonRoot
tableInfo
.
subTagets
=
commonPathResults
.
processedPaths
let
sameXpath
=
commonPathResults
.
commonRoot
let
subTagets
=
commonPathResults
.
processedPaths
// 先拼接xpath 根据xpath判断网页中是否有该元素,从最后一位向上找
let
resultElement
=
combineXPaths
(
tableInfo
.
sameXpath
,
tableInfo
.
subTagets
);
let
resultElement
=
combineXPaths
(
sameXpath
,
subTagets
);
// 判断是否有数据
if
(
resultElement
)
{
console
.
log
(
"Element found: "
,
resultElement
);
// 将页面过滤出来的元素的xpath进行元素查找,并且返回元素的xpath和内容
let
foundElements
=
findElements
(
resultElement
);
foundElements
=
findElements
(
resultElement
);
console
.
log
(
foundElements
);
return
foundElements
// 返回表格需要的格式
transformedData
=
foundElements
.
map
((
group
,
index
)
=>
{
let
transformedGroup
=
{};
group
.
elements
.
forEach
((
element
,
elemIndex
)
=>
{
transformedGroup
[
`content
${
elemIndex
}
`
]
=
{
Xpath
:
element
.
xpath
,
content
:
element
.
content
,
otherName
:
"请填写标题"
};
});
transformedGroup
[
"_X_ROW_KEY"
]
=
`row_
${
index
+
0
}
`
;
// 假设起始索引为8
return
transformedGroup
;
});
return
transformedData
}
else
{
console
.
log
(
"Element not found"
);
return
null
}
console
.
log
(
tableInfo
)
}
//获取相同的xpath路径,并将原始数组公共部分去除,公共部分根节点最后一位下标去除
...
...
@@ -150,4 +166,4 @@ function findElements (arrayObjects) {
return
results
;
}
export
{
getTableData
,
tableInfo
}
\ No newline at end of file
export
{
getTableData
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment