这里是使用 JavaScript 代码的示例,您可以尝试在 Selenium 中模拟步骤:
// get the container element first
const containerELe = document.querySelector("#output-container");
// get the br (second br in the container)
const brElement = containELe.querySelector('br:nth-of-type(2)');
// get the node after the br
const nameNode = brElement.nextSibling;
// get text content
const name = nameNode.textContent.trim();