从 Python 中的 DatePicker 中选择 [英] Select from a DatePicker in Python

查看:21
本文介绍了从 Python 中的 DatePicker 中选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我使用 Selenium webdriver(在 Python 中)代码来自动选择上述链接中输入日期中的日期.

Can anyone help me with the Selenium webdriver (in Python) code to automatically select a date in the input date in the above link.

https://www.nseindia.com/products/content/derivatives/equities/archieve_fo.htm

It is just one line of code but I've wasted hours behind it. someone please kindly help. I've tried the .send_keys() function and have searched for hours about the datepicker issue. Kindly help.

解决方案

You havn't mentioned exactly where you are stuck while automatically sending a date in the <input> tag. How ever the <input> tag is having type as text and the following code block works perfect :

  • Code Block :

     from selenium import webdriver
    
     driver=webdriver.Firefox(executable_path=r'C:path	ogeckodriver.exe')
     driver.get("https://www.nseindia.com/products/content/derivatives/equities/archieve_fo.htm")
     print("Page Title is : %s" %driver.title)
     driver.find_element_by_xpath("//input[@class='textboxdata hasDatepicker' and @id='date']").send_keys("10-04-2018")
    

  • Console Output :

     Page Title is : NSE - National Stock Exchange of India Ltd.
    

  • Snapshot :


References

You can find a couple of relevant detailed discussion in:

这篇关于从 Python 中的 DatePicker 中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆