Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中点击页面的验证码_Python_Web Scraping_Click - Fatal编程技术网

python中点击页面的验证码

python中点击页面的验证码,python,web-scraping,click,Python,Web Scraping,Click,我有以下html代码: <input id="luk" type="button" class="play-bt" value="Click Here To Generate Link"> 但我不知道下一步该怎么办,使用硒对我来说不是一个好方法,帮帮我!! 谢谢你可以用它来实现这一点 from bs4 import BeautifulSoup s = '''<iframe src="LINK_WEB" scrolling="no" frameborder="0" width

我有以下html代码:

<input id="luk" type="button" class="play-bt" value="Click Here To Generate Link">
但我不知道下一步该怎么办,使用硒对我来说不是一个好方法,帮帮我!! 谢谢你可以用它来实现这一点

from bs4 import BeautifulSoup

s = '''<iframe src="LINK_WEB" scrolling="no" frameborder="0" width="100%" height="100%" allowfullscreen="true">'''

soup = BeautifulSoup(s, 'lxml')

iframe_tags = soup.find_all('iframe')

for iframe in iframe_tags:
    print(iframe.src)

如果您没有使用
Selenium
,则可以使用
请求
库获取页面源代码。

但是,s仅在我单击“”时显示,如何单击此?单击之前的url与单击之后的url相同。然后,下载(url)单击“捕获新html with”,尝试使用
find_element_by_xpath
方法,使用以下模式:
'//input[/@value=“单击此处生成链接”]
。通过这种方式,您将有望找到元素并可以
。单击()
它以获得
驱动程序。page\u source
。使用beautifulsoup可以做到这一点吗?您不能使用
bs4
与页面交互。。。您可以通过组合使用
selenium+bs4
来实现这一点。是否需要使用selenium?(还有别的图书馆吗?)
try:
    boton = driver.find_element_by_id("luk")
    boton.click()
except:
    print "Element is not present"  
from bs4 import BeautifulSoup

s = '''<iframe src="LINK_WEB" scrolling="no" frameborder="0" width="100%" height="100%" allowfullscreen="true">'''

soup = BeautifulSoup(s, 'lxml')

iframe_tags = soup.find_all('iframe')

for iframe in iframe_tags:
    print(iframe.src)
s = driver.page_source