def get_attribute(self, selector, attribute, by=By.CSS_SELECTOR,<EOL>timeout=settings.SMALL_TIMEOUT):
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:<EOL><INDENT>timeout = self.__get_new_timeout(timeout)<EOL><DEDENT>if page_utils.is_xpath_selector(selector):<EOL><INDENT>by = By.XPATH<EOL><DEDENT>if page_utils.is_link_text_selector(selector):<EOL><INDENT>selector = page_utils.get_link_text_from_selector(selector)<EOL>by = By.LINK_TEXT<EOL><DEDENT>self.wait_for_ready_state_complete()<EOL>time.sleep(<NUM_LIT>)<EOL>element = page_actions.wait_for_element_present(<EOL>self.driver, selector, by, timeout)<EOL>try:<EOL><INDENT>attribute_value = element.get_attribute(attribute)<EOL><DEDENT>except (StaleElementReferenceException, ENI_Exception):<EOL><INDENT>self.wait_for_ready_state_complete()<EOL>time.sleep(<NUM_LIT>)<EOL>element = page_actions.wait_for_element_present(<EOL>self.driver, selector, by, timeout)<EOL>attribute_value = element.get_attribute(attribute)<EOL><DEDENT>if attribute_value is not None:<EOL><INDENT>return attribute_value<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" % (<EOL>selector, attribute))<EOL><DEDENT>
This method uses JavaScript to get the value of an attribute.