This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import base64 | |
import httplib | |
import urllib | |
import locale | |
import os | |
import mimetypes | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def _GET(self, path, queries=(), customHeaders={}): | |
return self._request('GET', path, queries, customHeaders=customHeaders) | |
... | |
def ping(self, username='admin', password='admin'): | |
self.set_basic_auth_credentials(username, password) | |
path = "ping" | |
return self._GET(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_email_addr(self, new_email): | |
WebDriverWait(self.selenium, 120).until(lambda s: self.is_element_visible(*self._username_locator)) | |
self.selenium.find_element(*self._edit_email_locator).click() | |
email_input_locator = self.selenium.find_element(*self._edit_email_locator) | |
ActionChains(self.selenium).move_to_element(email_input_locator).\ | |
double_click().perform() | |
#new_email_locator = self.selenium.find_element(*self._edit_email_locator) | |
email_input_locator.send_keys(new_email+"\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def click_sam_h1(self): | |
try: | |
self.selenium.find_element(*self._sam_h1_locator).click() | |
return True | |
except: | |
throw ("The header element should be visible, it's not, do something!") | |
Assert.true(home_page.click_sam_h1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_footer_version_text_visible(self): | |
return self.selenium.text(*self._footer_version_text_locator) | |
Assert.equal(home_page.is_footer_version_text_visible(), "Some Text") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_footer_version_text_visible(self): | |
#return self.selenium.find_elements_by_partial_link_text('Subscription Asset Manager Version') | |
return self.selenium.find_element(*self._footer_version_text_locator).text | |
Assert.equal(home_page.is_footer_version_text_visible(), "Some Text") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="jspContainer" style="width: 249px; height: 220px;"> | |
<div class="jspPane" style="padding: 10px 13px; top: 0px; width: 209px;"> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=1" style="display: none;">ACME_Corporation</a> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=2" style="display: none;">Org-X2YVL8SkHqThajDS</a> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=3" style="display: none;">Org-YL3P08ydJPNWz</a> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=4">SearchOrg-Vz2xIOuhX</a> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=5" style="display: none;">SearchOrg-ILDUWvvop</a> | |
<a class="fl clear" rel="nofollow" data-method="POST" href="/headpin/user_session/set_org?org_id=6" style="display: none;">SearchOrg-yb5bERhPPC</a> | |
<a class="fl clear" rel="nofol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def click_filtered_result(self, criteria): | |
_org_filtered_result_locator = (By.XPATH, "//a[contains(text(), '" + criteria + "')]") | |
#filtered_result_locator = self.selenium.find_element(*self._org_filtered_result_locator) | |
#ActionChains(self.selenium).move_to_element(filtered_result_locator).\ | |
# click().perform() | |
#WebDriverWait(self.selenium, 30).until(lambda s: self.is_element_visible(*self._org_filtered_result_locator)) | |
self.selenium.find_element(*self._org_filtered_result_locator).click() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_subscriptions_checkbox_locator = (By.XPATH, "//input[@type='checkbox']") | |
def select_subscription(self): | |
subs = self.selenium.find_elements(*self._subscriptions_checkbox_locator) | |
a_sub = choice(subs) | |
print subs | |
print a_sub | |
#self.selenium.find_element(a_sub).click() | |
a_sub_locator = self.selenium.find_element(*a_sub) | |
ActionChains(self.selenium).move_to_element(a_sub_locator).\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="actions"> | |
<input id="subscription_submit_button" class="submit dialogbutton" type="submit" value="Add to Key" style="display:none;" name="commit"> | |
<a id="fake_subscription_submit_button" class="dialogbutton button disabled">Add to Key</a> | |
</div> | |
_available_subscriptions_submit_locator = (By.XPATH, "//input[@id='subscription_submit_button']") | |
def click_submit_key(self): | |
#WebDriverWait(self.selenium, 10).until(lambda s: self.is_element_visible(*self._available_subscriptions_submit_locator)) |