Python 2.7 使用selenium,我无法获得数据

Python 2.7 使用selenium,我无法获得数据,python-2.7,selenium-webdriver,phantomjs,Python 2.7,Selenium Webdriver,Phantomjs,我已经用selenium+phantomJS成功地导航到一个iframe,但我没有得到数据 如果我在Midori浏览器中查看,我可以看到结果。 但是没有表的webdriver 以下是我的测试代码: link = 'http://ebelediye.fatih.bel.tr/alfa/servlet/hariciprogramlar.online.rayic?caid=1449' def get_site(): driver = webdriver.PhantomJS() dr

我已经用selenium+phantomJS成功地导航到一个iframe,但我没有得到数据

如果我在Midori浏览器中查看,我可以看到结果。 但是没有表的webdriver

以下是我的测试代码:

link = 'http://ebelediye.fatih.bel.tr/alfa/servlet/hariciprogramlar.online.rayic?caid=1449'

def get_site():
    driver = webdriver.PhantomJS()

    driver.get(link)
    driver.find_element_by_name('btnlistele').click()
    src = driver.find_element_by_tag_name('iframe').get_attribute('src')
    driver.get(src)
    print driver.page_source

这似乎是安全问题,因为您发送请求的频率很高

防洪卫士Güvenlik uyarısı!!! 不,不,不,不,不

只需添加一些延迟,如下所示:

import time

link = 'http://ebelediye.fatih.bel.tr/alfa/servlet/hariciprogramlar.online.rayic?caid=1449'

def get_site():
    driver = webdriver.PhantomJS()

    driver.get(link)
    time.sleep(1)
    driver.find_element_by_name('btnlistele').click()
    src = driver.find_element_by_tag_name('iframe').get_attribute('src')
    driver.get(src.replace('ISSK_KOD=', 'ISSK_KOD=999'))
    print driver.page_source

这与时间无关。而如果我直接询问iframe src,我会使用selenium.eg记录数据作为答案。这是1 iframe的url:使用selenium,我变成了一个只有隐藏字段的空站点,没有数据。是的,我在发布问题之前已经尝试过了。
iframe
的内容不会显示在
Chrome
Firefox
中。不是一个
Selenium
问题。使用我的代码,我可以获得
iframe
HTML
源代码。若有,;这不是你想要的,然后在你的question@vatay好啊我明白你的意思。问题是
iframe
src
不等于。。。它有空的
ISSK\u KOD
参数。所以您需要使用这一行
src.replace('ISSK_KOD=','ISSK_KOD=999')
。尝试更新的代码