Selenium IDE Flow Control (gotoif) - "Error: Specified label "labelName" is not found" - selenium

I am creating a test and before the test tests something, the language of the website has to be changed. After the gotoif which checks if the language isEnglish I want to jump to the label "labelChangeLanguage", but I always get the excpetion that it couldn't be found. But well, it's there.
Here the screenshot of the failing selenium test:
What am I doing wrong?

You have two gotoif conditional statements where you only need one. Just use the first one and then a gotoLabel for the next line like this:
gotoIf | '${isEnglish}'== 'true' | changeLanguage
goto | done
label | labelChangeLanguage
goto | done
label | done
The way it works, it will evaluage ${isEnglish}. If that's true it will jump to the label changeLanguage, if not, it immediately goes to the next line, which will jump to your done label. Note that I changed the label to remove the word label in the name for readability.

Related

Automatic Scroll SAP GUI

I'm trying to scroll until the end of the page and I recorded a script and did some changes. I thought of something like that
For i = 1 To END_PAGE
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").setCurrentCell i, "AUFNR"
Next
Where "AUFNR" is the name of the column I'm analyzing. But how do I know the END_PAGE if the code stops working when it checks a line it doesn't exist?
Here is a screenshot of the table I'm analyzing in SAP GUI
For example I could verify if EACH element has a text but unfortunely I don't know how to do that. Any ideas?

Access Form refusing to change focus from one text input to another

I've got a basic login form in Microsoft Access, where the VBA script I have to clear all Text Box' will not change the focus from one text box to another. The popup I get as you may have assumed is Run-time error '2110'. Even after multiple debugging steps and making sure that they're both enabled and visible, the script simply won't work as intended.
Here's my code:
1 | Private Sub Form_load()
2 | If Me.FirstInput.Visible = False Then
3 | Me.FirstInput.Visible = True
4 | End If
5 | If Me.LastInput.Visible = False Then
6 | Me.LastInput.Visible = True
7 | End If
8 | If Me.ErrorTxt.Visible = True Then
9 | Me.ErrorTxt.Visible = False
10| End If
11| Me.FirstInput.SetFocus
12| Me.FirstInput.Text = ""
13| Me.LastInput.SetFocus
14| Me.LastInput.Text = ""
15| Me.FirstInput.SetFocus
16| Me.LastInput.Visible = False
17| End Sub
The error is where I'm changing the focus to "LastInput" on line 13. If someone could give me some guidance onto how I could fix this or if you need any more information, then please let me know.
Edit: Just for the people wondering if either of my Text Box' have their Enabled or Locked properties set incorrectly:
The way you use the visible property, I guess that you want to force the user to enter the FirstName first, and I also guess that you have an AfterUpdate event procedure to hide the LastInput textbox if no reasonable firstname was entered...
Unfortunately, changing the value of the Text property is like typing the value into the textbox, meaning that the AfterUpdate event is fired which would hide the LastInput textbox so it can't get the focus.
I suggest to change the code a bit and use the Value property (which is the default property) to empty both textboxes:
Private Sub Form_Load()
FirstInput.Visible = True
LastInput.Visible = False
ErrorTxt.Visible = False
FirstInput = Null
LastInput = Null
End Sub
Check your control's "Enabled" property. I bet it is set to False.
Try referencing the form explicitly as in Form!Form1.LastInput.SetFocus
I know it seems silly but I have noticed in my own personal experience that I have encountered hiccups within access like you have mentioned and an explicit reference will clear it up.
Ok so I've managed to solve the issue at hand, as per a chat between me and #wakgtech. We decided between ourselves that instead of having to set the focus to change the text property of the object, that it would be better to scrap using the .SetFocus method all together and instead use the value property.
However now what I have discovered is that the Text Box' onEnter event was being called when I changed the value of the elements in question. So I turned around and ended up deleting them regardless.
The three times that the 'validation' code was being called, was when the attempt sign in button was clicked and if the enter key was pressed in either of the text box'. Where the values of the text box' where empty anyways, causing the error message element to become visible through that.
I thank everyone in this thread for your support, if you have any further questions onto how it was solved then please let me know in a comment. As of now, as I can't close it myself, I'm declaring my question answered/closed. Thanks again!

IntelliJ - select one word in text "FirstSecondThirdFourth"

How to select the word "Second" in the text "FirstSecondThirdFourth" when the keyboard pointer is placed on the word "Second" (or at the beginning of the word "Second" - between 't' and 'S')? Is there any shortcut? It would be very helpful when changing the name of the function or variable.
Make sure Use "CamelHumps" words option is enabled in Settings(Preferences) | Editor | General | Smart Keys;
Use Main menu | Edit | Extend Selection action and corresponding shortcut.
At least in Android Studio, you can get close by adding a key mapping. In Settings/Keymap, look for Editor Actions/Move Caret to Next Word with Selection in Different "CamelHumps" Mode.

How to read all values of dropdown in Selenium IDE

How to read all values of dropdown in Selenium IDE?
I have a dropdown which have values in it (for eg Dates), I need to select each value and click on submit button and generate the report again select the next value... the loop continues till the end of dropdown values.
How can i do this with Selenium IDE?
You can use a loop, the loop will cycle through the option in the dropdown.
List<WebElement> dropdown = driver.findElements(locator));
for(WebElement t : dropdown) {
String valueText = t.getText();
Select value = new Select(driver.findElement(locator);
value.selectByVisibleText(valueText);
buttonSubmit.click;
}
This is a little tricky to achieve elegantly within Selenium-IDE. As Apjuh mentioned, a loop would be the best way to select each value. Unfortunately, Selenium-IDE does not have any flow control commands by default. There are two choices here:
1) Implement every iteration of the loop manually. Not recommended.
2) Download and install the Flow Control plugin for Selenium-IDE. I don't have any experience using it myself, but I might try it for a bit now and report back with results.
From there, it ought to be possible to construct a loop that does what you need to do.
Edit: After having done battle with Selenium-IDE for the last half-hour, I can only conclude that Selenium-IDE probably isn't the best tool for the job here! The following commands do successfully imitate a for loop:
store | 0 | i
label | loopStart
getEval | alert("i = " + storedVars.i)
store | javascript{storedVars.i++;}
gotoIf | storedVars.i < 4 | loopStart
...but getting it to play well with a dropdown box (e.g. selecting the option at index i) was proving problematic and ultimately far too much hassle for what should be a simple task. If at all possible, I think it would be worth looking into Selenium WebDriver, which would allow the use of actual code. Using C#, Apjuh's answer would perform the job perfectly well, and I imagine it didn't take him half an hour to get that far!

Selenium IDE: how to popup a dialog and wait for user to click OK

Just wonder if we could do something like below when running a selenium scenario, which needs user's interaction to continue. Like wait for him to upload some images..
Till the step, the selenium popup a dialog saying: please complete something, then click the OK button to continue.
When user finishing the operation on the webpage, then click "OK", then the scenario's transaction is moving forward. Otherwise, stop on that step.
For the first bullet, I was thinking of below command:
Command:
waitForConfirmation
Target:
javascript{confirm("Please upload the images, then click OK to continue")}
Thanks in advance!
In selenium ide use storeeval command, different type of boxes
COMMAND | TARGET | VALUE
----------------------------------------------------------------------------
storeeval | alert("This is alert box") |
storeeval | prompt("This is prompt box. Please enter the value") | text
storeeval | confirm("this is cofirm box") |
Type | locator of text box | ${text}
1.) we can create a message box and can assign the value given in the message box to a text box.
Command:StoreEval
Target:prompt{("Enter the Message")}
Value:Text
here a pop up message box will pop up and you can enter some text into it and it will store in the variable "Text" the value in the Text can be assigned to a text box or other
Command:type
Target:id=id of the text box
value:${Text}
2.)same as above we can create an alert box
Command:StoreEval
Target:alert{("Enter the Message")}
Try these things
Thank you.