This commit is contained in:
g1879 2020-07-03 17:54:37 +08:00
parent 24e7406fea
commit e103a6a3e0
4 changed files with 13 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class Drission(object):
self._driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": """
Object.defineProperty(navigator, 'webdriver', {
get: () => undefined
get: () => Chrome
})
"""
})

View File

@ -30,6 +30,10 @@ class DriverElement(DrissionElement):
attrs = [f"{attr}='{self.attrs[attr]}'" for attr in self.attrs]
return f'<DriverElement {self.tag} {" ".join(attrs)}>'
@property
def driver(self) -> WebDriver:
return self._driver
@property
def attrs(self) -> dict:
"""返回元素所有属性及值"""

View File

@ -1023,6 +1023,10 @@ Parameter Description:
The wrapped WebElement object.
### driver
WebDriver object of the element.
### attrs
Return all attributes and values of the elements in a dictionary.

View File

@ -1020,6 +1020,10 @@ driver模式的元素对象包装了一个WebElement对象并封装了常
被包装的WebElement对象。
### driver
操作元素的WebDriver对象。
### attrs
以字典方式返回元素所有属性及值。