diff options
author | Zachary Sloan | 2013-08-22 16:54:13 -0500 |
---|---|---|
committer | Zachary Sloan | 2013-08-22 16:54:13 -0500 |
commit | b34e262f0371952fdec850483c0929d4f0a858d1 (patch) | |
tree | 6c1d04ddc6d92999b86e4ad3374f98ad222bd95f | |
parent | 2db8468a8e3e802588d97bdeb64b5b638d634bb6 (diff) | |
download | genenetwork2-b34e262f0371952fdec850483c0929d4f0a858d1.tar.gz |
Fixed import in show_trait_js_test.py
Added a function to browser_run.py that gets an element's style
-rw-r--r-- | webtests/browser_run.py | 8 | ||||
-rw-r--r-- | webtests/show_trait_js_test.py | 6 |
2 files changed, 11 insertions, 3 deletions
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() |