Exemplo n.º 1
0
 def __init__(self,webElement):
     '''
     关键点:div为webElement的定位,button为曲线输入区,ul为曲线下拉选择区
     <div id="divDropButton" class="btn-group" role="group" style="position: absolute; top: 0px; z-index: 1; left: 827px;">
             <button id="dropButton" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="width: 133px; background-color: #1B1B1B;
                 color: White; background-image: none; text-shadow: none; border-color: #FFF;
                 border-width: 3px; border-radius: 7px;padding-left: 0;">
                 <span id="chartTitle">拉出值曲线</span> <span class="glyphicon glyphicon-chevron-down" style="color: White;"></span>
             </button>
             <ul class="dropdown-menu" style="min-width: 127px; width: 127px; background-color: #1B1B1B;border-color: #FFF;border-width: 3px;">
                 <li style="background-color: #1B1B1B; color: White; background-image: none; text-shadow: none;
                     border-color: #FFF; border-width: 5px; border-radius: 7px;">
                     <a id="wd" href="javascript:void(0);" style="color: White;">
                         温度曲线
                     </a>
                 </li>
                 <li>
                     <a id="lc" href="javascript:void(0);" style="color: White;">拉出值曲线</a>
                 </li>
                 <li><a id="dg" href="javascript:void(0);" style="color: White;">导高值曲线</a></li>
                 <li><a id="wdd" href="javascript:void(0);" style="color: White;">温度导高值曲线</a></li>
             </ul>
     </div>
     :param webElement:
     '''
     #该判断不太合理,需要进一步研究
     if webElement.tag_name.lower()!='div':
         raise UnexpectedTagNameException(
             "Select only works on <div> elements, not on <%s>" %webElement.tag_name)
     self._el = webElement
Exemplo n.º 2
0
 def __init__(self, webelement):
     """
     Check that the given element is an autocomplete widget, and that all components can be found.
     If not, then an UnexpectedTagNameException is thrown.
     :param webelement: span element with id ending in '-wrapper' and containing class 'autocomplete-light-widget'
     """
     if webelement.tag_name.lower() != "span":
         raise UnexpectedTagNameException(
             "AutoComplete only works on <span> elements, not on <%s>" %
             webelement.tag_name)
     if webelement.get_attribute('id').split('-')[-1].lower() != 'wrapper':
         raise UnexpectedTagNameException(
             "AutoComplete only works on <span> elements with an id ending in -wrapper"
         )
     if 'autocomplete-light-widget' not in webelement.get_attribute('class').split(' '):
         raise UnexpectedTagNameException(
             "AutoComplete only works on <span> elements with a class containing in autocomplete-light-widget"
         )
Exemplo n.º 3
0
 def __init__(self, driver , id):
     '''
     初始化类,参数说明如下:
     '''
     self._dr=driver
     self._id=id
     if self._dr.find_element_by_id(self._id).tag_name.lower()!='input':
         raise UnexpectedTagNameException(
             "Select only works on <div> elements, not on <%s>" %self._dr.find_element_by_id(self._id).tag_name)
     self._el=self._dr.find_element_by_id(self._id)
     self._sid=relateID(self._dr,self._id)
     self._sel=self._dr.find_element_by_id(self._sid) #下拉列表元素区
Exemplo n.º 4
0
    def __init__(self, locator, context=None):
        """
        :type context: selenium.webdriver.remote.webelement.WebElement | selenium.webdriver.remote.webdriver.WebDriver
        """
        self._driver = RootElement()
        self._context = context or self._driver
        self._el = self._context.find_element(*locator)

        if self._el.tag_name.lower() != 'table' or \
           self._el.get_attribute('cmptype') != 'ComboBox':
            raise UnexpectedTagNameException(
                'Select only works on <table[cmptype="ComboBox"]> elements')
Exemplo n.º 5
0
 def __init__(self, driver, id):
     '''
     初始化类,参数说明如下:
     :param driver: 提供页面操作句柄,该句柄必须来自于webdriver
     :param componentID: 该控件关联文本框的ID(根据开发提供,所有控件必须操作ID)
     '''
     self._dr=driver
     self._id=str(id)
     if self._dr.find_element_by_id(self._id).tag_name.lower()!='input':
         raise UnexpectedTagNameException(
             "Select only works on <div> elements, not on <%s>" %self._dr.find_element_by_id(self._id).tag_name)
     self._el=self._dr.find_element_by_id(self._id)
     self._sid=relateID(self._dr,self._id)
     self._sel=self._dr.find_element_by_id(self._sid) #下拉列表元素区
Exemplo n.º 6
0
    def __init__(self, webelement):
        """
        Constructor. A check is made that the given element is, indeed, a DIV tag. If it is not,
        then an UnexpectedTagNameException is thrown.

        :Args:
         - webelement - Web element representing the React-Select container <div> element.

        """
        if webelement.tag_name.lower() != "div":
            raise UnexpectedTagNameException(
                "ReactSelect only works on <div> elements, not on <%s>" %
                webelement.tag_name)
        self._el = webelement
Exemplo n.º 7
0
    def __init__(self, webelement):
        """
        Constructor. A check is made that the given element is, indeed, a SELECT tag. If it is not,
        then an UnexpectedTagNameException is thrown.

        :Args:
         - webelement - element SELECT element to wrap
        
        Example:
            from selenium.webdriver.support.ui import Select \n
            Select(driver.find_element_by_tag_name("select")).select_by_index(2)
        """
        if webelement.tag_name.lower() != "select":
            raise UnexpectedTagNameException(
                "Select only works on <select> elements, not on <%s>" %
                webelement.tag_name)
        self._el = webelement
        multi = self._el.get_attribute("multiple")
        self.is_multiple = multi and multi != "false"
Exemplo n.º 8
0
def get_self_service_page(driver):
    """
    Navigates the driver to the self-service page of MyNEU.
    """
    # Get the top tag tree (MyNEU Central, Self-Service, Commmunity, etc.)
    tabs = driver.find_element_by_id("tabs_tda")

    # Find the tab with the text "Self-Service"
    # Only searches the other tags, not the current one
    for tag in tabs.find_elements_by_class_name("taboff"):
        self_service_tag = tag.find_element_by_id("tab")
        if self_service_tag.text == "Self-Service":
            break
    else:
        # If can't find the tag, just raise an exception.
        # If this occurs, check if they rearranged the order of the tags
        raise UnexpectedTagNameException("Couldn't find Self-Service Tag")

    # Click on the tag to navigate to the other page
    self_service_tag.click()
 def __init__(self, webtable):
     if webtable.tag_name.lower() != "table":
         raise UnexpectedTagNameException(
             "Select only works on <select> elements, not on <%s>" %
             webtable.tag_name)
     self.table = webtable
Exemplo n.º 10
0
 def __init__(self, webtable):
     if webtable.tag_name.lower() != "table":
         raise UnexpectedTagNameException(" Unexpected tagname <%s>" %
                                          webtable.tag_name)
     self.table = webtable