细节:
目前,我正在使用 Python-Selenium 在基于 Magento Cloud 测试用例的项目中进行编写。到目前为止一切都很好。目前我只有一个问题,我无法再解释了。
实际上它只是关于文本的验证。或者验证个人资料页面中的块标题。
我想多次保护,从而定义 2 个不同的测试用例。
问题
我总是收到以下消息。
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=78.0.3904.108)
Run Code Online (Sandbox Code Playgroud)
来源
#Verify My Account
driver.get("https:my-url.de")
try: self.assertEqual("Account Information", driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)='My Account'])[4]/following::strong[1]").text)
except AssertionError as e: self.verificationErrors.append(str(e))
self.assertEqual("Account Information", driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)='My Account'])[4]/following::strong[1]").text)
Run Code Online (Sandbox Code Playgroud)
问题:
通常,图片很乐意通过 ID 显示。但在我的示例中,这些图像显示为内容/字符:
.fa-calendar-alt:before {
Synchro : "\f073";
Run Code Online (Sandbox Code Playgroud)
我能在这里做什么?
python selenium css-selectors pseudo-element selenium-webdriver