开发者

css/selenium: visiblity of an element does not change

开发者 https://www.devze.com 2023-04-11 23:49 出处:网络
I have an element (text box), which has the following attribute: style=\"visibility: hidden;\" and style=\"visibility: visible;\"

I have an element (text box), which has the following attribute:

style="visibility: hidden;" and style="visibility: visible;"

When this textbox is empty the visibility is visible and vice-verse for when the textbox contains some text. Now, I have a test-case in selenium where I am trying to get the attribute value of this attribute. I remove all the text from the textbox and then check the style attribute. The following wired thing is happening: 1. When i run the test-case and the Firefox window running the test-case is in focus, then the style comes out fine (visible, after removing the text in the textbox) 2. But when that window is not in focus my test-case always fail开发者_开发问答s as the style attribute still shows 'hidden' even though i have removed the text from the text box.

could someone please help with this?

thanks


use this it ll work

selenium.get_eval("element = this.browserbot.findElement('locator'); vis =window.document.defaultView.getComputedStyle(element,null).getPropertyValue('visibility');")
0

精彩评论

暂无评论...
验证码 换一张
取 消