在python中使用硒进行网络抓取

时间:2019-06-25 15:37:48

标签: python html selenium

我想从此站点https://loschmidt.chemi.muni.cz/predictsnp2/抓取数据,但是在通过我的代码按下按钮后,我无法从表格中获取文本。我不知道我在做什么错,因为这是我第一次这样做。

from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By 
from selenium.webdriver.support.ui import WebDriverWait

driver = 
Webdriver.Firefox(executable_path='D:\\geckodriver\\geckodriver.exe ')
url = "https://loschmidt.chemi.muni.cz/predictsnp2/"
driver . get( url )
s = driver.find_element_by_id ( "isc_3I" )
st="6,1613076,A,T \n1,66075952,G,C \n1,201328373,G,A \n18,48575659,A,G 
    \n3,37067050,A,G"
s1 = driver.find_element_by_id ( 'isc_2S' )
s2 = driver.find_element_by_id ( 'isc_37' )
st1 = 'GRCh38.p1 '
s1 . send_keys ( st1 )
s2 . send_keys ( 'Simple' ) 
s . send_keys ( st )
driver . find_element_by_xpath ( '//div[@id="isc_4B"]' )
time . sleep ( 20 )
print ( driver . find_element_by_xpath ( '//div[@id="isc_4X"]' ) . text )
driver . quit()

C:\ Users \ kakkakksfssdsf \ PycharmProjects \ untitled \ venv \ Scripts \ python.exe C:/Users/kakkakksfssdsf/PycharmProjects/untitled/test.py

加载文件:

以退出代码0结束的过程

0 个答案:

没有答案