擅长:python、mysql、java
<p><strong>不会处理API,因为Nuran只会按照用户的要求处理</strong></p>
<p>下面是浏览前10页的示例。首先,我们删除通知。然后等待“下一步”按钮可交互并单击它</p>
<pre><code>wait = WebDriverWait(driver, 10)
driver.get("https://www.nasdaq.com/market-activity/stocks/screener")
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#_evh-ric-c"))).click()
#Currently you start on the 1st page and say we want to click 9 times for the 10th page
for pages in range(1,10):
try:
print(pages)
#Get your data from this page
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button.pagination__next"))).click()
#This is just here to slow everything so it may be removeable.
time.sleep(5)
except:
break
</code></pre>
<p>进口</p>
<pre><code>from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
</code></pre>
<p>你可以这样做</p>
<pre><code>html=driver.page_source
soup=BeautifulSoup(html,'html.parser')
div=soup.select_one("table.nasdaq-screener__table")
table=pd.read_html(str(div))
print(table[0])
</code></pre>