<tfoot id='zF0T5'></tfoot>

    1. <small id='zF0T5'></small><noframes id='zF0T5'>

      <legend id='zF0T5'><style id='zF0T5'><dir id='zF0T5'><q id='zF0T5'></q></dir></style></legend>
        <bdo id='zF0T5'></bdo><ul id='zF0T5'></ul>
        <i id='zF0T5'><tr id='zF0T5'><dt id='zF0T5'><q id='zF0T5'><span id='zF0T5'><b id='zF0T5'><form id='zF0T5'><ins id='zF0T5'></ins><ul id='zF0T5'></ul><sub id='zF0T5'></sub></form><legend id='zF0T5'></legend><bdo id='zF0T5'><pre id='zF0T5'><center id='zF0T5'></center></pre></bdo></b><th id='zF0T5'></th></span></q></dt></tr></i><div id='zF0T5'><tfoot id='zF0T5'></tfoot><dl id='zF0T5'><fieldset id='zF0T5'></fieldset></dl></div>
      1. 在 nseindia.com 上单击获取数据按钮以获取每月结算

        时间:2023-10-08
        <tfoot id='s8Qj4'></tfoot>

          <small id='s8Qj4'></small><noframes id='s8Qj4'>

          <legend id='s8Qj4'><style id='s8Qj4'><dir id='s8Qj4'><q id='s8Qj4'></q></dir></style></legend>
          • <bdo id='s8Qj4'></bdo><ul id='s8Qj4'></ul>

                • <i id='s8Qj4'><tr id='s8Qj4'><dt id='s8Qj4'><q id='s8Qj4'><span id='s8Qj4'><b id='s8Qj4'><form id='s8Qj4'><ins id='s8Qj4'></ins><ul id='s8Qj4'></ul><sub id='s8Qj4'></sub></form><legend id='s8Qj4'></legend><bdo id='s8Qj4'><pre id='s8Qj4'><center id='s8Qj4'></center></pre></bdo></b><th id='s8Qj4'></th></span></q></dt></tr></i><div id='s8Qj4'><tfoot id='s8Qj4'></tfoot><dl id='s8Qj4'><fieldset id='s8Qj4'></fieldset></dl></div>
                    <tbody id='s8Qj4'></tbody>
                  本文介绍了在 nseindia.com 上单击获取数据按钮以获取每月结算统计信息不会使用 Selenium 和 Python 获取结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试从

                  解决方案

                  我对你的代码添加了一些调整并运行测试如下:

                  • 代码块:

                    从 selenium 导入 webdriver从 selenium.webdriver.common.by 导入从 selenium.webdriver.support.ui 导入 WebDriverWait从 selenium.webdriver.support 导入 expected_conditions 作为 EC选项 = webdriver.ChromeOptions()options.add_argument("开始最大化")options.add_experimental_option("excludeSwitches", ["enable-automation"])options.add_experimental_option('useAutomationExtension', False)driver = webdriver.Chrome(options=options, executable_path=r'C:UtilityBrowserDriverschromedriver.exe')driver.get('https://www1.nseindia.com/products/content/equities/equities/eq_monthly_statistics.htm')Select(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"select#h_filetype")))).select_by_visible_text("资本市场")Select(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"select#yearField")))).select_by_visible_text("2019-2020")WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.getdata-button#get[type='image'][src^='/common/images/btn-get-data.gif']))).点​​击()

                  <小时>

                  观察

                  与您的观察类似,我遇到了同样的障碍,但没有结果如下:

                  <小时>

                  深入研究

                  似乎 Get Data 元素上的 click() 文本确实发生了.但是在检查 webpage 的 驱动 WebDriver 实例,响应被阻塞.

                  <小时>

                  参考文献

                  一些文档:

                  • 机器人管理器
                  • 机器人经理:基础
                  <小时>

                  tl;博士

                  几个相关的讨论:

                  • Selenium webdriver:修改导航器.webdriver 标志以防止硒检测
                  • 无法使用 Selenium 自动化 Chase网站登录

                  I am trying to scrape data from here.

                  By clicking on the capital market and 2019-20 year. I want to click on Get data.

                  I have used following code:

                  driver = webdriver.Chrome(executable_path=chrome_path,options=chrome_options)
                  
                  driver.get( nse_cash_keystats_page )
                  
                  
                   driver.find_element_by_xpath( "//select[@id='h_filetype']/option[text()='Capital Market ']" ).click()
                  
                  driver.find_element_by_xpath( "//select[@id='yearField']/option[text()='2019-2020']" ).click()
                  
                       downloadButton=WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH,'//input[@type="image"][@src="/common/images/btn-get-data.gif"]')))
                  
                  driver.execute_script("arguments[0].click();", downloadButton)
                  

                  By using the above code, I am able to click on Get DATA. But it is not showing output.

                  Please help me.Thanks in advance.

                  解决方案

                  I took your code added a few tweaks and ran the test as follows:

                  • Code Block:

                    from selenium import webdriver
                    from selenium.webdriver.common.by import By
                    from selenium.webdriver.support.ui import WebDriverWait
                    from selenium.webdriver.support import expected_conditions as EC
                    
                    options = webdriver.ChromeOptions() 
                    options.add_argument("start-maximized")
                    options.add_experimental_option("excludeSwitches", ["enable-automation"])
                    options.add_experimental_option('useAutomationExtension', False)
                    driver = webdriver.Chrome(options=options, executable_path=r'C:UtilityBrowserDriverschromedriver.exe')
                    driver.get('https://www1.nseindia.com/products/content/equities/equities/eq_monthly_statistics.htm')
                    Select(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"select#h_filetype")))).select_by_visible_text("Capital Market ")
                    Select(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"select#yearField")))).select_by_visible_text("2019-2020")
                    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.getdata-button#get[type='image'][src^='/common/images/btn-get-data.gif']"))).click()
                    


                  Observation

                  Similar to your observation, I have hit the same roadblock with no results as follows:


                  Deep Dive

                  It seems the click() on the element with text as Get Data does happens. But while inspecting the DOM Tree of the webpage you will find that some of the <script> tag refers to JavaScripts having keyword akam. As an example:

                  • <script type="text/javascript" src="https://www1.nseindia.com/akam/11/52349752" defer=""></script>
                  • <noscript><img src="https://www1.nseindia.com/akam/11/pixel_52349752?a=dD01ZDZiMTA5OGQ0MDljYTYxN2RjMjc3MzBlN2YwMDQ0NjlkZDNiNTMzJmpzPW9mZg==" style="visibility: hidden; position: absolute; left: -999px; top: -999px;" /></noscript>

                  Which is a clear indication that the website is protected by Bot Manager an advanced bot detection service provided by Akamai and the response gets blocked.


                  Bot Manager

                  As per the article Bot Manager - Foundations:


                  Conclusion

                  So it can be concluded that the request for the data is detected as being performed by Selenium driven WebDriver instance and the response is blocked.


                  References

                  A couple of documentations:

                  • Bot Manager
                  • Bot Manager : Foundations

                  tl; dr

                  A couple of relevant discussions:

                  • Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection
                  • Unable to use Selenium to automate Chase site login

                  这篇关于在 nseindia.com 上单击获取数据按钮以获取每月结算统计信息不会使用 Selenium 和 Python 获取结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:通过 Selenium - Python 在新选项卡中打开网址的最快 下一篇:使用 Selenium Python 和 chromedriver 截取整页截图

                  相关文章

                  最新文章

                        <bdo id='IqCCy'></bdo><ul id='IqCCy'></ul>
                    1. <i id='IqCCy'><tr id='IqCCy'><dt id='IqCCy'><q id='IqCCy'><span id='IqCCy'><b id='IqCCy'><form id='IqCCy'><ins id='IqCCy'></ins><ul id='IqCCy'></ul><sub id='IqCCy'></sub></form><legend id='IqCCy'></legend><bdo id='IqCCy'><pre id='IqCCy'><center id='IqCCy'></center></pre></bdo></b><th id='IqCCy'></th></span></q></dt></tr></i><div id='IqCCy'><tfoot id='IqCCy'></tfoot><dl id='IqCCy'><fieldset id='IqCCy'></fieldset></dl></div>

                      <small id='IqCCy'></small><noframes id='IqCCy'>

                    2. <tfoot id='IqCCy'></tfoot>
                    3. <legend id='IqCCy'><style id='IqCCy'><dir id='IqCCy'><q id='IqCCy'></q></dir></style></legend>