【问题标题】:Selenium fails to detect elements in ms teams (web) call interfaceSelenium 无法检测 ms 团队(Web)调用界面中的元素
【发布时间】: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 我添加了一个示例边文件代码( 必须在代码中替换)。
  • @Prophet 那是由 selenium IDE 在 chrome (chrome.google.com/webstore/detail/selenium-ide/…) 上加载的 .side 文件的内容。这就是我一直在执行测试的内容,因此是“selenium-ide”标签。据我所知,唯一涉及的其他代码是 IDE 本身的代码。

标签: selenium selenium-chromedriver microsoft-teams selenium-ide


【解决方案1】:

问题是在设置调用时输入了 iframe,但未执行切换回默认框架。一旦发出适当的命令以换回默认上下文,问题就解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-01
    • 1970-01-01
    • 2013-09-20
    • 2018-02-04
    • 2018-03-31
    • 2020-08-28
    • 1970-01-01
    • 2019-07-03
    相关资源
    最近更新 更多