上周重装系统升级了python版本从3.6升级到了3.8,发现旧的脚本不能用了,显示如下
提示:
find_element_by_* commands are deprecated. Please use find_element() instead
看了下 为啥之前的方法不能用了,如下
def find_element_by_id(self, id_) -> WebElement:
"""Finds an element by id.
:Args:
- id\_ - The id of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driver.find_element_by_id('foo')
"""
warnings.warn(
"find_element_by_* commands are deprecated. Please use find_element() instead",
DeprecationWarning,
stacklevel=2,
)
return self.find_el