From b34e262f0371952fdec850483c0929d4f0a858d1 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 22 Aug 2013 16:54:13 -0500 Subject: Fixed import in show_trait_js_test.py Added a function to browser_run.py that gets an element's style --- webtests/browser_run.py | 8 +++++++- webtests/show_trait_js_test.py | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'webtests') diff --git a/webtests/browser_run.py b/webtests/browser_run.py index b2058cf8..2ec299c5 100644 --- a/webtests/browser_run.py +++ b/webtests/browser_run.py @@ -13,7 +13,8 @@ from selenium.webdriver.common.keys import Keys class Test(object): def __init__(self): - self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') + #self.browser = webdriver.Chrome('/home/gn2/gn2/webtests/chromedriver') + self.browser = webdriver.Firefox() def get(self, url): self.browser.get(url) @@ -52,6 +53,11 @@ class Test(object): el = self.browser.find_element_by_xpath(xpath_selector) text = el.text.strip() or el.get_attribute("value").strip() print("text:", text) + + def get_element_style(self, xpath_selector): + el = self.browser.find_element_by_xpath(xpath_selector) + style = el.get_attribute("style").strip() + print("style:", style) def switch_window(self): self.browser.switch_to_window(self.browser.window_handles[-1]) diff --git a/webtests/show_trait_js_test.py b/webtests/show_trait_js_test.py index 5e8b72bf..7a98af6a 100644 --- a/webtests/show_trait_js_test.py +++ b/webtests/show_trait_js_test.py @@ -29,12 +29,14 @@ A new window is created, so we switch to it >>> test.switch_window() title: KIN/YSM Human OFC Affy Hu-Exon 1.0 ST (Jul11) Quantile : 3081205: Display Trait - +Check that the Calculate Correlations tab is closed (if javascript isn't working, it will be open) +>>> test.get_style('''//*[@id="sectionbody3"]''') +style: "display: none;" """ from __future__ import absolute_import, division, print_function -from browser_test import * +from browser_run import * testmod() -- cgit v1.2.3