0

I am struggling to get the attribute value of a web element which is actually hidden on the page. I am using python+selenium and I do not nkow how to get this value. Please help! For your reference, here is a sample python code that I have written:

AttValueBeforeUpdateButtonAppears = WebDriverWait(self.driver, 15).until(lambda     driver:self.driver.find_element_by_css_selector(CustomizeYourCheck.UPDATE_BUTTON_HIDDEN).get_attribute('style'))

print AttValueBeforeUpdateButtonAppears
self.assertIn("hidden", AttValueBeforeUpdateButtonAppears)
Praveen Pandey
  • 658
  • 3
  • 16
  • 32
  • This is the css locator that I have written for CustomizeYourCheck.UPDATE_BUTTON_HIDDEN-> 'span[id='UpdatePrice2'][style='visibility:hidden;']' and it locates correctly when I do it in FirePath – Praveen Pandey Jul 18 '13 at 12:22
  • Check this answer: http://stackoverflow.com/a/15049248/771848 – alecxe Jul 18 '13 at 12:29
  • @alecxe:This is what I wrote. I dont get the hidden button(actually an image) so that I can take it's style attribute value. `try: abc = self.driver.execute_script("document.getElementById('UpdatePrice2').style.display='block'") print abc AttValueBeforeUpdateButtonAppears = self.driver.find_element_by_css_selector(CustomizeYourCheck.UPDATE_BUTTON_HIDDEN).get_attribute('style') print AttValueBeforeUpdateButtonAppears self.driver.execute_script("document.getElementById('UpdatePrice2').style.display='none'") except NoSuchElementException: assert 0, "Can't find hidden button"` – Praveen Pandey Jul 19 '13 at 08:59
  • @Praveen When you have extra information, it's better to edit your question to include it there. If you put it in a comment it's much harder to read, and it's more difficult for any new reader to understand the question without scanning through all the comments. – Vince Bowdren Aug 07 '13 at 09:02

0 Answers0