Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>First you can read the jquery from a jquery.js or jquery.min.js file.</li> <li>Then using execute_script(jquery) to enable jquery dynamically.</li> <li>Now you can interact with jquery. </li> </ul> <p>here is some code: </p> <pre><code>browser = webdriver.Firefox() # Get local session of firefox with open('jquery.min.js', 'r') as jquery_js: #read the jquery from a file jquery = jquery_js.read() browser.execute_script(jquery) #active the jquery lib #now you can write some jquery code then execute_script them js = """ var str = "div#myPager table a:[href=\\"javascript:__doPostBack('myPager','%s')\\"]" console.log(str) var $next_anchor = $(str); if ($next_anchor.length) { return $next_anchor.get(0).click(); //do click and redirect } else { return false; }""" % str(25) success = browser.execute_script(js) if success == False: break </code></pre> <p>PS: When I use Selenium to fetch some content from some website, they always ban me. Now you should use some proxy to go over it.<br> here is some code: </p> <pre><code>PROXY_HOST = "127.0.0.1" PROXY_PORT = 8087 SOCKS_PORT = 8088 fp = webdriver.FirefoxProfile() # Direct = 0, Manual = 1, PAC = 2, AUTODETECT = 4, SYSTEM = 5 fp.set_preference("network.proxy.type", 1) fp.set_preference("network.proxy.http", PROXY_HOST) fp.set_preference("network.proxy.http_port", PROXY_PORT) fp.set_preference("network.proxy.socks", PROXY_HOST) fp.set_preference("network.proxy.socks_port", SOCKS_PORT) fp.set_preference("network.proxy.ftp", PROXY_HOST) fp.set_preference("network.proxy.ftp_port", PROXY_PORT) fp.set_preference("network.proxy.ssl", PROXY_HOST) fp.set_preference("network.proxy.ssl_port", PROXY_PORT) fp.set_preference("network.proxy.no_proxies_on", "") # set this value as desired browser= webdriver.Firefox(firefox_profile=fp) # with proxy browser = webdriver.Firefox() # no proxy browser.get("http://search.example.com") # Load page elem = browser.find_element_by_id("query_box") # Find the query input elem.send_keys(u'my query string') # send query string to the input elem.submit() # submit the query form </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload