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
07480c73
Commit
07480c73
authored
Nov 18, 2023
by
高源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
table函数getData方法获取表全部数据
parent
2f5b0346
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
collectionTable.vue
src/components/collectionTable.vue
+1
-0
sdk-table.js
src/sdk-table.js
+19
-7
No files found.
src/components/collectionTable.vue
View file @
07480c73
...
...
@@ -85,6 +85,7 @@ export default {
_table
.
newCell
(
_this
.
Xpaths
[
i
])
}
_table
.
verify
()
_table
.
getData
()
console
.
log
(
_table
)
// console.log(_this.table)
//----------------------
...
...
src/sdk-table.js
View file @
07480c73
...
...
@@ -39,7 +39,7 @@ function table () {
}
else
{
break
;
}
//如果发现不同的,直接就可以退出了
}
}
console
.
log
(
tableXpath
)
if
(
tableXpath
.
length
<
1
)
return
_isVerified
;
//如果没有共同父节点,返回false
while
(
tableXpath
.
length
>
0
)
{
...
...
@@ -59,6 +59,21 @@ function table () {
*/
this
.
getData
=
function
()
{
if
(
!
_isVerified
)
return
null
;
//如果还没通过验证不返回数据
console
.
log
(
this
.
cells
)
let
relativeXpaths
=
[]
for
(
let
i
=
0
;
i
<
this
.
cells
.
length
;
i
++
)
{
relativeXpaths
.
push
(
this
.
cells
[
i
].
relativePath
)
}
// 找出的全部xpath信息
let
resultElement
=
combineXPaths
(
this
.
cells
[
0
].
_tableXpathArray
,
relativeXpaths
);
let
xpaths
=
[]
// 当前表的全部xpath
console
.
log
(
resultElement
)
for
(
let
i
=
0
;
i
<
resultElement
.
length
;
i
++
)
{
for
(
let
k
=
0
;
k
<
resultElement
[
i
].
paths
.
length
;
k
++
)
{
xpaths
.
push
(
resultElement
[
i
].
paths
[
k
])
}
}
console
.
log
(
xpaths
)
}
}
/**
...
...
@@ -99,7 +114,7 @@ function cell (xpath, name = "", type = "", title = "") {
this
.
updateRelativePath
=
function
(
parentXpath
)
{
this
.
_tableXpathArray
=
parentXpath
;
//其实这边严谨的来说要验证一下XPath是否真的有相同的根
this
.
_relativeXpathArray
=
_xpathArray
.
slice
(
this
.
_tableXpathArray
.
length
);
// this.relativeXpath = _relativeXpathArray
// this.relativeXpath =
this.
_relativeXpathArray
// this.tableXpath = _tableXpathArray
// console.log(this._relativeXpathArray)
}
...
...
@@ -108,7 +123,7 @@ function cell (xpath, name = "", type = "", title = "") {
* @returns {boolean}
*/
this
.
isExist
=
function
(
cell
)
{
console
.
log
(
cell
)
let
existCount
=
0
;
let
_tableXpathArray
=
[...
cell
.
_tableXpathArray
]
//深拷贝,值修改不影响原数组
let
_relativeXpathArray
=
[...
cell
.
_relativeXpathArray
]
//深拷贝,值修改不影响原数组
...
...
@@ -118,14 +133,11 @@ function cell (xpath, name = "", type = "", title = "") {
let
lastElementWithoutIndex
=
lastElement
.
split
(
'['
)[
0
];
_tableXpathArray
[
_tableXpathArray
.
length
-
1
]
=
lastElementWithoutIndex
;
}
_tableXpathArray
=
_tableXpathArray
.
join
(
'/'
)
_relativeXpathArray
=
_relativeXpathArray
.
join
(
'/'
)
//table[0]+relativeXpath,可以不存在,因为可能是表头,1,2
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
let
isGetElement
=
elementExists
(
_tableXpathArray
+
'['
+
(
i
+
1
)
+
']'
+
'/'
+
_relativeXpathArray
)
console
.
log
(
isGetElement
)
if
(
isGetElement
)
{
existCount
=
i
}
else
{
...
...
@@ -311,7 +323,7 @@ function combineXPaths (commonXPath, paths) {
// 然后去除公共路径最后一个元素的下标
// let samePath =''
let
commonPath
=
[];
commonPath
=
commonXPath
commonPath
=
[...
commonXPath
]
if
(
commonPath
.
length
>
0
)
{
let
lastElement
=
commonPath
[
commonPath
.
length
-
1
];
let
lastElementWithoutIndex
=
lastElement
.
split
(
'['
)[
0
];
...
...
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