_call_函数
class hello():
def __init__(self,b):
print(b)
# 将类模拟成函数
def __call__(self, a):
print(a)
if __name__ == "__main__":
h = hello("hello")
h("hhaha")
执行结果
hello
hhaha
title_is、title_contains
判断当前网页的标题
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
res1 = EC.title_is("百度一下,你就知道")(driver)
print(res1)
res2 = EC.title_contains("百度一下")(driver)
print(res2)
driver.close()
driver.quit()
网友评论