Skip to content

Commit

Permalink
iOS端视图树dump页面,增加chassChain定位方式的录入
Browse files Browse the repository at this point in the history
  • Loading branch information
caofengbin committed Aug 24, 2023
1 parent 6f7c8c3 commit fa945a2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locales/lang/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ const IOSRemote = {
'点击开始抓包后,Wifi设置手动代理,连接右上角对应的ip与端口,即可开启抓包',
filterClassOrName: '输入class或name进行过滤',
predicate: 'Predicate推荐',
classChain: 'classChain推荐',
noRecommend: '暂无推荐语法',
};
export default {
Expand Down
46 changes: 46 additions & 0 deletions src/views/RemoteEmulator/IOSRemote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ const findBestNS = (elementDetail) => {
result.push(r);
return result;
};
const findBestClassChain = (elementDetail) => {
const result = [];
if (elementDetail.name) {
result.push(`**/${elementDetail.type}[\`name == \"${elementDetail.name}\"\`]`);
result.push(`**/${elementDetail.type}[\`name CONTAINS \"${elementDetail.name}\"\`]`);
}
if (elementDetail.label) {
result.push(`**/${elementDetail.type}[\`label == \"${elementDetail.label}\"\`]`);
result.push(`**/${elementDetail.type}[\`label CONTAINS \"${elementDetail.label}\"\`]`);
}
return result;
};
const findBestXpath = (elementDetail) => {
const result = [];
if (elementDetail.name) {
Expand Down Expand Up @@ -2801,6 +2813,40 @@ const checkAlive = () => {
</el-table-column>
</el-table>
</el-form-item>
<el-form-item :label="$t('IOSRemote.classChain')">
<el-table
stripe
:empty-text="$t('IOSRemote.noRecommend')"
border
:data="findBestClassChain(elementDetail)"
:show-header="false"
>
<el-table-column>
<template #default="scope">
<span
style="cursor: pointer"
@click="copy(scope.row)"
>{{ scope.row }}</span
>
<el-icon
v-if="project && project['id']"
color="green"
size="16"
style="
vertical-align: middle;
margin-left: 10px;
cursor: pointer;
"
@click="
toAddElement('classChain', scope.row)
"
>
<Pointer />
</el-icon>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item
:label="$t('androidRemoteTS.code.xpath')"
>
Expand Down

0 comments on commit fa945a2

Please sign in to comment.