SeldomQA / poium

Page Objects design pattern test library, support selenium、appium、playwright, etc
https://pypi.org/project/poium
Apache License 2.0
404 stars 138 forks source link

get_attribute 无法调用 #14

Closed liutan102 closed 4 years ago

liutan102 commented 4 years ago

提示: tt = page.wtoip_shangpin.get_attribute('textContent') E AttributeError: 'NoneType' object has no attribute 'get_attribute'

defnngj commented 4 years ago

请提供更详细的版本信息和报错:

> pip show poium
Version: 0.6.0

以下代码可以正常运行,例子:

from poium import Page, NewPageElement
from selenium import webdriver

class BaiduIndexPage(Page):
    search_input = NewPageElement(name='wd')

driver = webdriver.Chrome()
page = BaiduIndexPage(driver)
page.get("https://www.baidu.com")
att = page.search_input.get_attribute("id")
print("=>", att)