About iteration in Selenium IDE - selenium-ide

I am newbie/beginner to Selenium IDE, i am running a test on a web application.
I wish to have a input of username into a textbox, let say 100 times how could i done this?
What i should type in the source or value column?
I want result somehow similar to
for (i=1;i<=100;i++)
{
value = "user" + i ;
}
(but i have no idea how to do it ...)
Then the test will going to loop 100 times and everytime will input different username like
User1 .... first time
User2 .... second time
Any helps would be appreciated. Thank you very much!

This approach should also work as well, using the SelBlocks extension.
for | i=1; i <= 100; i++ |
type | id=fieldname |user ${i}
endFor| |

You need to use parametrization with looping, you can refer
Selenium IDE: How to Pass Variables

Related

Selenium ide: already logged in or not?

I'm working with Selenium Ide 2.9.1.
The problem is to check if, beginning the automatic process, the user has already logged in.
So, on the first page of www.pageexample.com I need to check if id=welcome is JOHN SMITH.
If yes, the user has already logged in and then it's possible to go on with the following instruction (clickandwait | id=button10).
If not (I mean id=welcome is not present in the page), the login is needed (and in this case I've already built the instuctions).
I've installed Selenium IDE: flow control.
Taking a cue from the suggestion, I've elaborate the following code that seems to work:
storeElementPresent | id=loginbutton | x
storeElementPresent | id=sitename | y
gotoIf | x=y | z
....... operations of log in .......
label | z |
loginbutton is present only if the users has not logged in, sitename is always present (therefore always true): so, comparing the two values, in case of correspondence Selenium proceeds with the operation of log in, otherwise jumps to label z.
I know, it's an escamotage that can surely be improuved.

Not able to select desired value form dropdown while running webdriver script

On running webdriver code control finds the dropdown clicks on it but selection of a value does not occur. I tried with "select by index" and "select by value" methods but no use. I think it sof type bootstrap dropdown.most posts direct to usage of aforesaid functions but im unable to use it . any help will be greatly appreciated.
50
100
200
300
400
500
We really need more information, including what programming language you are using, what code you are executing, and the HTML you are executing against. Looking at your comment in your original question, and without knowing any of the aforementioned, all I can suggest is selecting the times with XPATH. In Python it would be something like:
driver.find_element_by_xpath("//select[#ng-model='recordnumber']/option[#value='300']").click() # this would select the "300" item
Thanks for your effort but i found the solution . just we need to click on the dropdown and call sendKeys("value to be entered into the dropdown").
Eg: drp=findElement(By.xpath("dropdown element locator").click();
drp.sendKeys("value to shown in dropdown");

date in pig latin

I am trying to do the following. I have multiple dates and I want to create a pig script which gets unknown number of input dates and then runs the pig script for the input arguments. My question is:
How can I send an unknown number of input variables to a pig script and then handle them within the pig script?
Thanks
Sara
I have some trouble understanding what you actually want to do. That would be my solution >for your problem, sending an unknown number of dates (sorted as chararray):
A = load 'input_dates' AS (date:chararray);
B = my_macro(A);
It's quite basic, so I guess I didn't understand your problem correctly. Could you maybe >develop a little bit more your problem?
UPDATE >> How about something like this if you use Pig 0.11 (there is a bug until 0.10 for module imports):
#!/usr/bin/python
import os
from org.apache.pig.scripting import *
P = Pig.compile("""
data = LOAD '$docs_in' AS (a:int);
-- do something
""")
lof = os.listdir("/home/.../dates/")
params = []
for elem in lof:
params.append({'docs_in': str(elem)})
lof.remove(elem)
bound = P.bind(list_of_files)
stats = bound.run(params)
If each run is counting on the result of the previous one, use runSingle() instead.
If I understand question correctly, you want to load number of files or directories. You can specify as "," as input.
Below is an example:
load.pig (content):
A = LOAD '$input' using PigStorage();
dump A;
command to run ( to run locally):
pig -x local -param input=20120301,20120302,20120304 load.pig

SSRS Variable Expression - Sum, Sum, Scope?

I'm trying to write an expression for a variable (not parameter), so that I can use/reference it to do a calculation in another textbox. I have multiple datasets, and I need the SUM(SUM(Fields!amount.Value)) for each of these datasets. I am then going to use these numbers in another textbox, adding them with each other. I need some assistance with the syntax. I am able to use SUM by itself, without an issue. For example, this works fine:
=SUM(Fields!Amount.Value, "DataSet1")
But I get an error when trying to amend it to the following (which is what I actually need):
=SUM(SUM(Fields!amt.Value, "Acctrange_90300_90399_InterestExpenses"))
I get an error saying
"The variable expression for the report 'body' uses an aggregate
expression without a scope. A scope is required for all aggregates
used outside of a data region unless the report contains exactly one dataset."
I have a hunch that there's a problem with my syntax/parantheses placement. Any suggestions?
could you please provide a detailed example with maybe sample data and an expected solution?
Because I do not understand why you want to SUM(SUM()). The inner SUM() would result in a single integer value, why would you want to do another SUM on just a single value. even if it worked, it would just be the same value. I apologize if I understood the question wrongly, i can't comment, so i am answering, but I want to know clearly what you are looking for. I can understand if you are trying to do SUM( SUM(), SUM(), SUM()...). As in, sum of sums.
Sorry again for answering just to inquire more info, but I can't see a comment option.
UPDATE:
ok now i think you have something like
| a | b | c | d |
---------------------------
1 | * | * | * | * |
---------------------------
2 | * | * | * | * |
---------------------------
3 | * | * | * | * |
---------------------------
total | w | x | y | z |
so SUM(Fields!a.Value) would give you w, and SUM(Fields!b.Value) would give you x, and so on.
and you want w+x+y+z? If that is so, then you can do this:
add a calculated field to your dataset to calculate the row totals like
{ (a1+b1+c1+d1),(a2+b2+....), .... },
and then from your variable, call
SUM(Fields!CalculatedField.Value).
for above example, you can give the calculated field an expression as:
= CInt(Fields!a.Value)+CInt(Fields!b.Value)+CInt(Fields!c.Value)+CInt(Fields!d.Value)
this would make each entry in the calculated field as sum of each entry in all fields.
So sum of calculated field would give you your answer.
Hope thats what you wanted. Otherwise, well I tried understanding the problem. :)
Outer SUM needs a scope too. Try this:
=SUM(SUM(Fields!amt.Value,"Acctrange_90300_90399_InterestExpenses"),"Acctrange_90300_90399_InterestExpenses")
I expect this will also fail--in some new & different way--but that error will get you closer to a solution.
When SSRS wants to give me headaches like this, I cheat. I put the inner calculation in a hidden text box or name the box that displays it if I want it to show, then refer to it by name. So if I had the sum of the first column in a text box called txtFirstColumnSum, and the second column sum in the text box called txtSecondColumnSum, I'd use:
=cdec(ReportItems!txtFirstColumnSum.Value)+ cdec(ReportItems!txtSecondColumnSum.Value)...
Another way to do it is using the built-in scopes, but writing custom code to handle the math between the fields.
For example if I want the percentage of the current YTD sales over the same period the prior year, and also want to check for divide by zero, I can do it in an expression, but I use it on several levels, so instead I made custom code:
Public Function DeltaPercent(ByVal currentAmount as decimal,ByVal pastAmount as Decimal) as Decimal
Dim difference as decimal
Dim result as decimal
if pastAmount<>0 then
difference=currentAmount-pastAmount
result=difference/pastamount
else
result=0
end if
return result
End Function
Then to get the % change, I call it:
=Code.DeltaPercent(Sum(Fields!SalesYTD.Value, "SalesTerritory"),Sum(Fields!SalesPY1TD.Value, "SalesTerritory"))
One tip I wish I'd known sooner: If you use the syntax
ReportItems("txtFirstColumnSum").Value
you have to make sure you type it right. If you use the bang syntax (!) above, you get intellisense.

How can I get the extension entered by user in a Perl AGI script?

I'm new to Asterisk AGI programming. Im trying to create a simple IVR, using asterisk-perl, where a user can enter any extension from 1 to 4. Here is my code so far:
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
for($i = 0 ; $i < 2 ; $i++)
{
$AGI->exec('Playback','welcome');
$AGI->exec('WaitExten','5|m');
}
Now, I want to know the extension the user entered and take some action accordingly. How to get the extension entered by the user?
Thank You.
I believe you want to use get_data, allowing you to play a file and then wait a given time for a given number of digits e.g.:
$AGI->get_data('demo-welcome', 15000, 5);
See here
Well since the WaitExten command changes the user to a new extension, I suppose you can read the special variable ${EXTEN} after calling WaitExten. I'm not familiar with Asterisk::Perl though, I've only used FastAGI from Java, so I don't know the exact command, but there must be some command to read a variable's value.