Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.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 在Selenium测试中去掉JQuery日期选择器_Python_Jquery Ui_Testing_Selenium_Selenium Rc - Fatal编程技术网

Python 在Selenium测试中去掉JQuery日期选择器

Python 在Selenium测试中去掉JQuery日期选择器,python,jquery-ui,testing,selenium,selenium-rc,Python,Jquery Ui,Testing,Selenium,Selenium Rc,我正在编写一个Selenium测试来填充网页上的日期字段。该字段与JQuery日期选择器关联。当我使用“type”功能输入日期时,会弹出选择器。然而,我不能让它消失,即使我转移焦点,点击另一个字段等。我已经尝试了以下直到现在 # Python Code # Setting the date in the field sel.focus('tradeDate') sel.type('tradeDate', '8/16/2011') # Trying to get rid of the date

我正在编写一个Selenium测试来填充网页上的日期字段。该字段与JQuery日期选择器关联。当我使用“type”功能输入日期时,会弹出选择器。然而,我不能让它消失,即使我转移焦点,点击另一个字段等。我已经尝试了以下直到现在

# Python Code
# Setting the date in the field
sel.focus('tradeDate')
sel.type('tradeDate', '8/16/2011')

# Trying to get rid of the date picker popup, none of these work
sel.key_press('tradeDate', '5')          # Trying to TAB out
sel.focus('link=[Search Filters]')       # Trying to set focus to something else
sel.focus('searchDirectory')             # Trying to set focus to another text field
sel.fire_event('tradeDate', 'blur')
sel.click('//span[@onclick="toggleTradeDetails(\'14859\',this);"]')
以上这些似乎都不起作用。我实际上并没有尝试测试JQuery。“tradeDate”字段有自己的onClick事件定义,这就是我实际上要测试的

因此,我如何才能摆脱日期选择器弹出窗口。我想我在用Selenium RC对抗IE 8

您不需要使用sle.focus函数,因为您使用的是sel.type及其附带的

元素id。因此它知道在何处键入值。我认为sel.focus导致日期字段提前弹出jquery日期选择器


如果这个问题没有解决,请发布HTML代码以查看Jquery日期选择器在文本框中的确切位置。

我通过使用mouseMove、mouseDown和mouseUp selenium命令移动到页面上的另一个字段来解决这个问题,如果有帮助,它将删除日期选择器。

。。。我们使用的一种解决方法是让selenium在日期选择器sel.clickid\u date sel.clicklink=8上单击一个月的某一天