[Webtest] Form fields

Dierk König Dierk König
Fri, 3 Apr 2015 22:53:14 +0200


It could be that you need a setInputField with and xpath attribute - in case that your form is somehow generated via JavaScript.
http://webtest.canoo.com/webtest/manual/setInputField.html

cheers
Dierk

> Am 03.04.2015 um 14:34 schrieb Nicholas Lievens =
<nicholas.lievens@protime.eu>:
> 
> Hi all,
> 
>  
> 
> I’m new to testing with WebTest. I’m trying to fill in =
some values on a form that is within a frame (e.g. announceVisitor$LastNameTextBox) . When executing the test it picks up the frame as it should but the test fails.  The reason for this I think is the fact that the contents of the form are not loaded (only the frame is). When I open the Error Page in the report I see the frame but it should contain the form and its contents (input fields) but it doesn’t. Does anyone have
> 
>  
> 
> My test looks like  the following:
> 
>  
> 
>  
> 
> <?xml version="1.0"?>
> 
>  
> 
> <!DOCTYPE project SYSTEM "../dtd/Project.dtd">
> 
>  
> 
> <project default="test">
> 
>                 <target name="test">
> 
>                                <webtest name="Login to MyApp">
> 
>                                                <invoke =
url="http://myurl.test"/>
> 
>                                                <setInputField =
name="Username" value="999"/>
> 
>                                                <setInputField =
description="Set password field Password: 999" name="Password" value="999"/>
> 
>                                                <clickButton =
label="Login"/>
> 
>                                                <followFrame =
name="contents"/>
> 
>                                                <clickElement =
xpath="//td[text()='Cell']"/>
> 
>                                                <clickLink =
label="MyLink"/>
> 
>                                                <followFrame =
name="main"/>
> 
>                                                <selectForm =
name="WebForm1"/>
> 
>                                                <setSelectField =
htmlId="hostEmployeeSelect" value="User, Test"/>
> 
>                                                <setInputField =
name="announceVisitor$LastNameTextBox" value="test"/>
> 
>                                                <setInputField =
name="announceVisitor$FirstNameTextBox" value="test"/>
> 
>                                                <setInputField =
name="announceVisitor$EmailTextBox" value="user.test@test.eu"/>
> 
>                                                <setInputField =
name="announceVisitor$PlateNumberTextBox" value="test"/>
> 
>                                                <clickButton =
id="okButton"/>
> 
>                                </webtest>
> 
>                 </target>
> 
> </project>
> 
>  
> 
>  
> 
> Best Regards,
> 
> Nicholas                             
> 
> -------------------------------------
> 
> Dit e-mailbericht en alle documenten die ermee verzonden worden, zijn =
vertrouwelijk en uitsluitend bestemd voor gebruik door de persoon of de onderneming waaraan ze geadresseerd zijn.  Indien deze e-mail verkeerdelijk bij u terechtkomt, gelieve de afzender te verwittigen en deze bestanden van uw computer te verwijderen.
> 
> Ce message e-mail ainsi que tous les fichiers transmis sont =
confidentiels et uniquement destinés à l'usage de la personne ou de l'entité à qui ils sont adressés.  Si vous avez reçu ce message e-mail par erreur, veuillez en informer l'expéditeur et le supprimer de tout ordinateur.
> 
> This e-mail and any files transmitted with it are confidential and =
intended solely for the use of the individual or entity to whom they are addressed.  If you have received this e-mail in error please notify the sender and delete the material from any computer.
> 
> Diese E-mail und alle mit ihr gesendeten Dateien sind vertraulich und =
sind nur für den Empfänger und nicht für kommerzielle Zwecke zugelassen. Falls Sie diese E-mail unberechtigterweise erhalten haben, informieren Sie bitte den Absender und löschen Sie alle hier relevanten Dateien.
> 
> -------------------------------------
>