小编Mor*_*non的帖子

Python Selenium:块标题未正确验证。(Magento 云)

细节:

目前,我正在使用 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)

问题:

  • 我是否使用了正确的查询?显然没有?
  • 是不是因为 Magento
  • 如何检查这些块?

    selenium.common.exceptions.StaleElementReferenceException:消息:过时的元素引用:元素未附加到页面文档

在此处输入图片说明

python selenium magento python-3.x selenium-webdriver

6
推荐指数
1
解决办法
165
查看次数

Python + Selenium - 如何检查使用 CSS 设置样式并显示为内容的图像?

细节 通常,图片很乐意通过 ID 显示。但在我的示例中,这些图像显示为内容/字符:

.fa-calendar-alt:before {
    Synchro : "\f073";
Run Code Online (Sandbox Code Playgroud)

我能在这里做什么?

python selenium css-selectors pseudo-element selenium-webdriver

6
推荐指数
1
解决办法
403
查看次数