Action
We have built-in web page behaviors that make it easier for you to operate web pages.You may use the Action in the pre_load.
type of action
We have implemented 7 actions
import crawlist as cl
action = cl.Action
action.click(...args)
action.inputKeyword(...args)
action.sendEnter(...args)
action.switchLastTab(...args)
action.switchTab(...args)
action.searchRedirect(...args)
action.redirect(...args)
what is pre_load?
The pre_load is used in dynamic pager in order to process the webdriver before the analyzer works.
import crawlist as cl
class MyPager(cl.DynamicLineButtonPager):
def pre_load(self, webdriver: WebDriver = None) -> None:
webdriver.get("https://kuaixun.eastmoney.com/")
cl.Action.click(webdriver, '/html/body/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[3]/label/span[1]')
parms of action
click
driver – selenium webdriver
xpath – Click on the xpath path of the button
inputKeyword
driver – selenium webdriver
xpath – The xpath path of the input box keyword – keyword needs to be passed in
sendEnter
driver– selenium webdriver
xpath – The xpath path of the input box
switchLastTab
driver – selenium webdriver
switchTab
driver – selenium webdriver
index – The index handle
searchRedirect
driver – selenium webdriver
url – Link containing %s
keyword – keyword needs to be passed in
redirect
driver – selenium webdriver
url – Links that require redirection
Last updated