开放接口说明RxCrawler接口
RxCrawler类提供对目标网站操作和得到网页上元素的能力, 包括打开网页,基于网页上的XPath得到网页上对应的元素。
函数定义:
def open(url)
打开指定的url网页。
def get_node_by_xpath(xpath)
在使用open函数打开网页后,使用xpath参数返回一个RxNode对象对应的是页面上找到的html元素。
def get_nodelist_by_xpath(xpath)
在使用open函数打开网页后,使用xpath参数返回RxNode对象List, 对应的是页面上找到的html元素列表。
def input(xpath, text)
在使用open函数打开网页后,基于指定的xpath为对应的html元素输入文本。
def clear(xpath)
在使用open函数打开网页后,基于指定的xpath为对应的html元素清除文本。
def get_page_source()
得到页面的html源代码。
def get_title()
得到页面的Title。
def back()
网页返回上一次访问的链接。
def forward()
网页前进到上一次访问的链接。
def refresh()
刷新当前页面。
def scroll_to_top()
在使用open函数打开网页后,滚动页面到顶部。
def scroll_to_bottom()
在使用open函数打开网页后,滚动页面到底部。
def scroll(pixels)
在使用open函数打开网页后,滚动页面多少个像素。pixels参数为正值时向下滚动,为负值向上滚动。
def is_alert_displayed()
检查是否有Alert警告框弹出。
def get_alert_text()
当网页弹出警告框口,得到弹出框的文本。
def close_alert()
关闭页面中弹出的alert对话框。
def sleep(time)
当前插件程序暂停指定的秒数。
def is_new_tab_opened()
判断点击后是否打开了新的tab页,如果有有新打开的tab页返回True,否则返回False
def switch_to_new_tab()
跳转到新打开的tab页
def close_new_tab()
关闭打开的tab页,一般跟switch_to_new_tab()成对使用。