Selenium 无法检测 ms 团队(Web)调用界面中的元素
Posted
技术标签:
【中文标题】Selenium 无法检测 ms 团队(Web)调用界面中的元素【英文标题】:Selenium fails to detect elements in ms teams (web) call interface 【发布时间】:2022-01-13 04:09:47 【问题描述】:Selenium 未检测 microsoft 团队 (Web) 调用界面中的元素(在调用已连接后)。例如:
'Store xpath count' action with xpath=\\profile-picture
返回零个条目(事先使用显式等待以确保页面已完全加载)
完全相同的 xpath,使用 chrome 的开发工具执行,返回 4 个条目。
其他操作和其他元素(包括使用 selenium ide 的定位器选择器选择的元素)也获得了类似的结果。
这里有什么我遗漏的东西阻止我拾取这些元素吗?
该页面似乎没有任何 iframe(这可能导致此行为)。
从 selenium IDE 端文件请求代码试用(NB 需要登录的团队实例,没有其他弹出窗口和电话号码进行测试):
"id": "d0ff19e7-9ada-4a49-96f3-f43649709cff",
"version": "2.0",
"name": "TeamsTest",
"url": "",
"tests": [
"id": "e9060b4d-c8d0-4ad4-972c-029bc4403b4c",
"name": "Untitled",
"commands": [
"id": "cdd5f51d-31b9-465a-9d64-c7c6b8ad19a9",
"comment": "",
"command": "open",
"target": "/_#/calls/saved-calls",
"targets": [],
"value": ""
,
"id": "094ae461-1b76-442d-822f-36c844913720",
"comment": "",
"command": "setWindowSize",
"target": "1366x698",
"targets": [],
"value": ""
,
"id": "20dd83d6-d0e3-4ccf-8ae7-55a90acf1791",
"comment": "",
"command": "waitForElementPresent",
"target": "xpath=//iframe[starts-with(@id,'experience-container')]",
"targets": [],
"value": "30000"
,
"id": "6600e22d-8d34-4aee-86d1-78d79929b34a",
"comment": "",
"command": "selectFrame",
"target": "index=0",
"targets": [],
"value": ""
,
"id": "27542c6e-b6f5-4f53-a54e-4a51708f6d1a",
"comment": "",
"command": "type",
"target": "id=people-picker-input",
"targets": [],
"value": "<phone number>"
,
"id": "49de70ea-857e-46b3-aa7f-bd6a5da78d43",
"comment": "",
"command": "click",
"target": "xpath=//button[contains(.'Call')]",
"targets": [],
"value": ""
,
"id": "4b20b541-c56c-44ba-a4ad-fbe3c3abec50",
"comment": "",
"command": "pause",
"target": "10000",
"targets": [],
"value": ""
,
"id": "6aa3673a-6b4f-4543-aea1-5b370f83942f",
"comment": "",
"command": "storeXpathCount",
"target": "xpath=//profile-picture",
"targets": [],
"value": "out"
,
"id": "2eba7802-2b98-4765-9fe7-cc664803af4d",
"comment": "",
"command": "echo",
"target": "$out",
"targets": [],
"value": ""
]
],
"suites": [
"id": "6b30048a-ecf9-4c60-bc27-cde0df580edd",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["e9060b4d-c8d0-4ad4-972c-029bc4403b4c"]
],
"urls": [],
"plugins": []
【问题讨论】:
邮政编码试验。 @ArundeepChohan 我添加了一个示例边文件代码(问题是在设置调用时输入了 iframe,但未执行切换回默认框架。一旦发出适当的命令以换回默认上下文,问题就解决了。
【讨论】:
以上是关于Selenium 无法检测 ms 团队(Web)调用界面中的元素的主要内容,如果未能解决你的问题,请参考以下文章
是否存在无法检测到的 Selenium WebDriver 版本?
如何通过 Python 使用 GeckoDriver 和 Firefox 使 Selenium 脚本无法检测?
如何使用 Selenium Web 驱动程序检测 Windows 身份验证提示?
带有Python的Selenium Webdriver - 无法使用Selenium Web驱动程序在Web应用程序中提供输入(Date)