WET FAQ (Freqently Asked Questions)
This is a growing list of FAQs about WET. Hopefully most of the limitations mentioned here have been raised as JIRA requests. This FAQ section captures the typical how to sort of questions. If you are unable to start WET or running into problems while using WET, there is a good chance that you may find your answers in the Known issues section or by searching through the list of bugs that have already submitted in the WET Issue Tracker
Is there a way to ignore a row on a spreadsheet from running?
You probably will need to use a workaround in your script. Wrap you
Is there a way to ignore a row on a spreadsheet from running?
You probably will need to use a workaround in your script. Wrap your whole script around an if-else statement which does nothing if the iteration matches the one that you want to ignore. You can use datatable.get_category method to determine what the current category is. However the current category returns the name of the category (and not the column number). For example your test script could be
if datatable.get_category != "Bad value"
# write logic for doing the actual test.
end
Can I make WetRunner store a separate results file for each run?
There is a way to do this. However, you will only be able to do so by asking the test definitions to create a new folder for each test run. Test definitions(and the global configuration class) have the ability to
be confiugred either as a string literal or as a dynamically evaluated value. For example, you would be able to say:
results.path = eval #{Time.now.strftime("%Y%m%d%H%M")}/results
When using SciTE to edit .qws files, no colours appear (like they do when editing .rb)? Is there a reason why .rb is not used as an extension?
No. WetRunner.rb loads both the *.qws as well as *.rb type of files. So you can use either the *.rb file or the *.qws as the extension.
You can make SciTE show Ruby tags by using the menu Language->Ruby for any type of file.
Is it possible to write values back to an excel spreadsheet with the inbuilt WET datatable support?
WET scripting is done using Ruby. Just about anything can be done using WET. Although you cannot do this directly by using WET's inbuilt datatable support, you can do this by using Ruby's scripting interface with excel. More information is available at:
http://rubygarden.org/ruby?ScriptingExcel
You may also create a text file and write (or append) text to it, to create a tab delimted text file. (using standard ruby IO functionality)
Is it possible to end a transaction programmatically?
There is no direct method to do it. It sounds like a nice to have feature. However you can try the following workaround in your script
if Some_condition
raise "I want to break out of this transaction"
end
This will cause the script to stop at that line and move on to the next transaction.
You could also use a method in your script, and then use the return command.
Can scripts in a following transaction to see variables created by the transaction immediately preceeding it in the same test.def?
Not directly - unless you define a global variable.
How can I get the WATIR object contained by my WET object
<WET_OBJECT>.native_object()
How can I get the IE object contained by my WATIR object
<WATIR_OBJECT>.getOLEObject()
Is there a way for WET to maximise the browser upon launch, for example when using: ie = Browser.new() ?
There is a solution using just Internet Explorer. (Thanks to VENUGOPAL S SHENOY)
- Open any Internet Explorer Window
- Hold down the <Ctrl> <Alt> & <Shift> keys together, and resize the Internet Window to the required size, by extending the borders.
- Once the required size is made, then unpress the <Ctrl> <Alt> & <Shift> keys.
- Close the Internet Explorer Window
- Open the Internet Explorer Window again manually, or using Browser.new() function.
- The Internet Explorer Window opens in the new size.
- Logically it may not be a maximized window, but by making the window resize in such a way that it occupies the whole screen, can make it practically appear maximized.
I see orphen RB command windows opening when i use click_withou_blocking method and then the scripts hangs?
This is actually not a problem with WET as such. Some times the Rubywindow file doesnt work. Restarting the Windows some time might help. OR try the following steps that should solve the problem.
1. Download and install the latest WET Gem file.
2. Navigate to the file
(local_ruby_drive):\ruby\lib\ruby\gems\1.8\gems\wet-web-(version_no).(rev_no)-mswin32\
3. Open the file wet.rb using any editor.
4. Goto the line 285 you see the following line:
exec_cmd = "start rubyw -e " +
5. Change "rubyw" to "ruby" and then save the changes made.
This should eventually solve the issue. However one child command window will open for each method call of click_without_blocking and then that will be killed as soon as the popup window is closed.
Sometimes the XML datasheet doesnt open in Internet Explorer, after converting the Excel Datasheet to XML format: (Or shows the error "Cannot convert nill:Nill calss to string" when using the XML datatable)
Each time the Excel datatable is converted into the XML format, open with the IE to test the XML files. If the XML file is not formed correctly will show an error "Cannot convert nill:Nill calss to string". This might happen once in hundred times. If you find this issue then delete the XML file generated and then create that XML file again using Excel to XML parser. This should solve the issue
Does WET support clicking of the Browser's "Back" Button?
Wet does not currently support clicking the Browser's "Back" Button. A possible workaround you could use is:
ie = Browser('title:=Google')
# Store the previous URL
prev_url = ie.url()
ie.TextField('name:=q').set "WATIR"
ie.Button('value:=Google Search').click
ie = Browser('title:=/^.*Google Search.*/')
# navigate to the previous URL (like hitting back)
ie.goto(prev_url)
Some times the simulated browser does not show the changes made like setting the text etc. The browser however shows the entered text.
The reason for this is that the simulated browser does not get refreshed sometimes. You can load the simulated browser again by selecting Sync Browser from the View Menu.
When I Right-Click on the WET Rpc Manager and select Exit, a Warning dialog box appears where I can select Yes or No. Even When I select No, the tray icon disappears.
If this happens, then start the Rpc Manager again from Start->All Programs->Qantom->WET->Rpc Manager.
Help! I am getting a Buffer error when trying to install wet gem!!!
This is an issue with Ruby-gems itself. See http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3927&group_id=426
.
Somewhere after version 0.9.1.100, we started seeing this issue. If you ever see this issue, then you need to edit the Ruby Gems package itself. Typically it is at C:\ruby\lib\ruby\site_ruby\1.8\rubygems\package.rb.
Open this file, go to line number 545(Assuming you are gem version 0.8.3), and change
if Zlib::ZLIB_VERSION < '1.2.1'
TO
if Zlib::ZLIB_VERSION <= '1.2.1'
After this if you try to install the gem again, all should work fine.
WET UI recognises wrong values for labels when adjacent items are other input.This happend when i opened the url:http://thwameva.qantom.int/webmail
and i created few transactions and one of the transactions being searching for the mail by giving an input in the textfield and choosing an option in the drop down box which has options like,INBOX,Drafts,Trash,Sent.But when i add folders which is another transaction,the search transaction performed will not run and displays a message saying "Cannot locate Watir Edit()" when we run the whole test.
Tip:Try to change the values for key,value in the object store manager in the wet ui for this particular object by verifying in the source code.
To check the source code open the webpage and click on the search option and right click on the free space of the webpage ,click on view source and search for this particular input or the type of that object,for ex:in this case it is select and this can be acheived by pressing cntrl+f and typing in the required text.
Also refer to the bug id 175 in JIRA to view the screen shot to check the object which is referd.
Reason:The label doesn't get recognised becuase when we add folders,which gets added in the drop down box along with the existing folders like INBOX,Drafts,etc...