⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 websession.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*                      ID_ID_TYPE and NAME_ID_TYPE are accepted             *//* Returns: description of the link.                                         *//*                                                                           *//*****************************************************************************/            public HashMap summarizeLink(String linkID, int idType) throws                            InvalidElementIDException    {            WebLink link = findLink(linkID, idType);                try         {            return link.getSummary();                        }catch (NullPointerException e)        {            throw new InvalidElementIDException (linkID, "Link " + linkID);        }    }    /*****************************************************************************//*                                                                           *//* Method: listLinks                                                         *//* Description: return a summary of all links in the current page            *//* Parameters: None                                                          *//* Returns: the summary of all links in the current page                     *//*                                                                           *//*****************************************************************************/    public HashMap[] listLinks()    {            return parser.listLinks();    }/*****************************************************************************//*                                                                           *//* Method: followLink                                                        *//* Description: Send the session to the target of the specified link in the  *//*              current page.  If the link is not in the page or an invalid  *//*              id type was specified throw an InvalidElementException.      *//* Parameters: linkID - the identified for the link                          *//*             idType - the type of id used to identify the link             *//*                      ID_ID_TYPE and NAME_ID_TYPE are accepted             *//* Returns: void                                                             *//*                                                                           *//*****************************************************************************/            public void followLink(String linkID, int idType, Boolean redirect) throws        InvalidElementIDException, MalformedURLException, IOException,        STAFException    {            WebLink link = findLink(linkID, idType);                try         {            HashMap request = link.getRequest();            request.put(REQUEST_REDIRECT, redirect);                        requestMethod(request);                        }catch (NullPointerException e)        {            throw new InvalidElementIDException (linkID, "Link " + linkID);        }    }/*****************************************************************************//*                                                                           *//* Method: findForm                                                          *//* Description: Find the specified form in the current page.  If the form is *//*              not in the page or an invalid id type was specified throw an *//*              InvalidElementException.                                     *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//* Returns: the form                                                         *//*                                                                           *//*****************************************************************************/        protected WebForm findForm(String formID, int idType)                                throws InvalidElementIDException    {        if (idType == NAME_ID_TYPE)            return parser.getFormByName(formID);                    if (idType == ID_ID_TYPE)            return parser.getFormByID(formID);            if (idType == INDEX_ID_TYPE)        {            // Make sure specified index is numeric            try            {                int index = (new Integer(formID)).intValue();            }catch (NumberFormatException e)            {                throw new InvalidElementIDException(                    formID, "FORM INDEX " + formID + " is not an integer");            }            return parser.getFormByIndex(Integer.parseInt(formID));        }        throw new InvalidElementIDException(formID, "Bad ID Type.");    }/*****************************************************************************//*                                                                           *//* Method: getFormControlIDs                                                 *//* Description: Get the control ids in the specified form in the current     *//*              page.  If the form is not in the page or an invalid id type  *//*              was specified throw an InvalidElementException.              *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//* Returns: a list of control ID's                                           *//*                                                                           *//*****************************************************************************/        public String[] getFormControlIDs(String formID, int idType)                                   throws InvalidElementIDException    {        WebForm form = findForm(formID, idType);        return form.getParameterKeyList();    }/*****************************************************************************//*                                                                           *//* Method: setFormElement                                                    *//* Description: Set the value of the specified control in the specified form *//*              in the current page.  If the form is not in the page or an   *//*              invalid id type was specified or an invalid control name was *//*              specified throw an InvalidElementException.                  *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//*             elementID - the id of the control                             *//*             value - the value ot assign to the control                    *//* Returns: void                                                             *//*                                                                           *//*****************************************************************************/        public void setFormElement(String formID, int idType,    String elementID,                                String value) throws InvalidElementIDException,                                                InvalidParameterValueException    {        WebForm form = findForm(formID, idType);                try         {            form.setParameterValue(elementID, value);                        }catch (NullPointerException e)        {            throw new InvalidElementIDException (formID, "Form " + formID);        }    }/*****************************************************************************//*                                                                           *//* Method: summarizeForm                                                     *//* Description: Get the information about a form.  If the form is not in the *//*              page or an invalid id type was specified throw an            *//*              InvalidElementException.                                     *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//* Returns: description of the form.                                         *//*                                                                           *//*****************************************************************************/            public HashMap summarizeForm(String formID, int idType) throws                            InvalidElementIDException    {            WebForm form = findForm (formID, idType);                try         {            return form.getSummary();                        }catch (NullPointerException e)        {            throw new InvalidElementIDException (formID, "Form " + formID);        }    }/*****************************************************************************//*                                                                           *//* Method: summarizeFormElement                                              *//* Description: Get the information about a form control.  If the form is not*//*              in the page or an invalid id type was specified throw an     *//*              InvalidElementException.                                     *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//*             formControlKey - the key used to identify the form contorl    *//* Returns: description of the form.                                         *//*                                                                           *//*****************************************************************************/            public HashMap summarizeFormControl(String formID, int idType,                                         String formControlKey) throws                            InvalidElementIDException    {            WebForm form = findForm (formID, idType);                try         {            return form.getParameterSummary(formControlKey);                        }catch (NullPointerException e)        {            throw new InvalidElementIDException (formID, "Form " + formID);        }    }    /*****************************************************************************//*                                                                           *//* Method: listForms                                                         *//* Description: return a summary of all forms in the current page            *//* Parameters: None                                                          *//* Returns: the summary of all forms in the current page                     *//*                                                                           *//*****************************************************************************/    public HashMap[] listForms()    {            return parser.listForms();    }/*****************************************************************************//*                                                                           *//* Method: getFormElement                                                    *//* Description: Get the value of the specified control in the specified form *//*              in the current page.  If the form is not in the page or an   *//*              invalid id type was specified or an invalid control name was *//*              specified throw an InvalidElementException.                  *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//*             elementID - the id of the control                             *//* Returns: the value of the specified control                               *//*                                                                           *//*****************************************************************************/            public String getFormElement(String formID, int idType,    String elementID)                                 throws InvalidElementIDException    {        String value = null;                WebForm form = findForm(formID, idType);                try         {            value = form.getParameterValue(elementID);                    }catch (NullPointerException e)        {            throw new InvalidElementIDException (formID, "Form " + formID);        }                return value;    }/*****************************************************************************//*                                                                           *//* Method: submitForm                                                        *//* Description: Submit the specified form in the current page.  If the form  *//*              is not in the page or an invalid id type was specified       *//*              specified throw an InvalidElementException.                  *//* Parameters: formID - the identified for the form                          *//*             idType - the type of id used to identify the form             *//*                      ID_ID_TYPE INDEX_ID_TYPE and NAME_ID_TYPE are        *//*                      accepted                                             *//* Returns: void                                                             *//*                                                                           *//*****************************************************************************/            public void submitForm(String formID, int idType, Boolean redirect) throws        MalformedURLException, IOException, FileNotFoundException,        InvalidElementIDException, STAFException    {        WebForm form = findForm(formID, idType);                try         {            HashMap request = form.getRequest();            request.put(REQUEST_REDIRECT, redirect);                        requestMethod(request);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -