Using Python to simulate the browser access, encountered page problem, but I used a lot of methods, Firefox access to the page no problem, with PhantomJS access, you can not page.
Source address: http://chufa.qingdao.gov.cn/E…
The method of turning pages is used in the following ways:
# 1.Directly locate to the 'next page' label and clickA = driver.find_element_by_link_text ('next page')A.click ()The tagging 2. step by step to locate the labels that are clicked (essentially the same as 1).NuM = driver.find_element_by_class_name ('pageNumber')A_tags = num.find_elements_by_class_name ('Number')A = a_tags[-1]A.click ()3. in the search box to enter the page number, and return to the carInput = driver.find_element_by_xpath ("//input[@id='WebP")AgeNumber1_input'] ")Input.clear ()Input.send_keys (STR (i+1)) I as a loop numberInput.send_keys (Keys.ENTER)Be4. direct execution of JS, this method comes from Baidu, I do not understand JS, but FireFox can run.JS ='document.getElementsByClassName ("Number") .click(); 'Driver.execute_script (JS)
But each method uses driver = webdriver.Firefox ().
Driver = webdriver.PhantomJS () is not successful. Why?