Selenium 无法检测 ms teams (web) 调用界面中的元素

Selenium fails to detect elements in ms teams (web) call interface

Selenium 未检测 Microsoft Teams (Web) 调用界面中的元素(调用连接后)。例如:

'Store xpath count' action with xpath=\profile-picture 

Returns 零个条目(事先使用显式等待以确保页面已完全加载)

完全相同的 xpath,使用 chrome 的开发者工具执行,返回 4 个条目。

其他操作和其他元素(包括使用 selenium ide 的定位器选择器选择的元素)也获得了类似的结果。

这里有什么东西让我无法拾取这些元素吗?

该页面似乎没有任何 iframe(这可能会导致此行为)。

请求来自 selenium IDE side 文件的代码试用(注意需要登录的团队实例,没有其他弹出窗口和 phone 号码来测试):

{
  "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": []
}

问题是在设置呼叫时输入了 iframe,但没有切换回默认框架。一旦发出了切换回默认上下文的适当命令,问题就解决了。