storeTextPresent by ID selenium IDE - selenium-ide

---Jump down to my edit with a simplistic example---
I have searched Ad Nauseum, and spent hours getting this close, but still not solving my automation problem.
Here's the thing I convert the local paper from the print edition to the online edition through PDF's, the content gets pushed to the website and is not live, until I go in and edit some settings, a lot of these are redundant. so if I can get past this one point I'm golden and can shave literally hours off of the time it takes to do this work.
The paper has twenty or thirty writers, and the one_off_byline can vary a bit here is some examples.
id=id_one_off_byline value="Michael Reid" however it may also look like the these next two or some variation thereoff even.
id=id_one_off_byline value="By Michael Reid"
id=id_one_off_byline value="By Michael Reid - Your Daily Paper"
I have used storeTextPresent to find Michael on the page. however the problem is there is another select value box on the page that contains every writers name in a selection box, which is what I'm actually trying to populate. So here is what I have
<tr>
<td>storeTextPresent</td>
<td>Jeff</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}</td>
<td>Jeff</td>
</tr>
<tr>
<td>storeTextPresent</td>
<td>Graham</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}</td>
<td>Graham</td>
</tr>
<tr>
<td>label</td>
<td>Jeff</td>
</tr>
<tr>
<td>label</td>
<td>Graham</td>
</tr>
Another way to phrase this I hope___
Form Field 1 (ignore syntax, I'm just setting up an example here) the id= is the important part in the two form fields.
<select name="select" id="pick_animal" value="">
< option="the fast cat" id="1">
< option="the fast dog" id="2">
</select>
Form Field 2
<input type="text" id="some_animal" value="the fast cat from dover">
I need to detect that id="some_animal" contains cat
so I can perform an action on the correct option in field 1.
I can do the second part just fine, I just can't detect "cat" in only the input with id "some_animal"
storeTextPresent just looks for cat to exist anywhere on the page. ugh!!

<tr>
<td>storeTextPresent</td>
<td>Jeff</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}==Jeff</td>
<td>Jeff</td>
</tr>
<tr>
<td>goto</td>
<td>END</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>Jeff</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>something</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>END</td>
<td></td>
</tr>
Try like this.

Related

How to adjust the size of Moodle embedded-answer (Cloze) questions?

When students encounter a Short Answer or a Numerical question, they are presented with a text box in which they can enter their answer. Their answers will be compared to a list of allowed answers provided during the question authoring. I'm trying to adjust the size of the questions text boxes in case of a question consisting of multiple subquestions.
The length of the text box is computed based on the length of the longest answer including the wrong answers. In case of multiple SA subquestions, I've added the same dummy wrong answer to all embedded-answers.
Subquestion 1: {1:SA:%100%A~%0%XXXX}
Subquestion 2: {1:SA:%100%BB~%0%XXXX}
Subquestion 3: {1:SA:%100%CCC~%0%XXXX}
Subquestion 4: {1:SA:%100%DDDD~%0%XXXX}
where XXXX is the dummy wrong answer.
In the example below, I also show the HTML code to show the use of tables for a better control over question and embedded-answer boxes alignment.
<table>
<tbody>
<tr>
<td>
Subquestion 1:
</td>
<td>{1:SA:%100%A~%0%XXXXX}</td>
</tr>
<tr>
<td>
Subquestion 2:
</td>
<td>{1:SA:%100%BB~%0%XXXXX}</td>
</tr>
<tr>
<td>
Subquestion 3:
</td>
<td>{1:SA:%100%CCC~%0%XXXXX}</td>
</tr>
<tr>
<td>
Subquestion 4:
</td>
<td>{1:SA:%100%DDDD~%0%XXXX}</td>
</tr>
</tbody>
</table>
Markup text and preview of Moodle embedded-answers
The same length dummy answers seems to work. Is there any other known way to adjust the sizes of the embedded-answer text boxes?

Selenium IDE - stopping execution of test case at successfull test

I would like to stop the execution of a test case if a condition is true.
So vice versa of assert. Something like BreakIfElementPresent
Possible?
I have used gotoIf statements to fail some of my tests for logging.
<tr>
<td>storeElementPresent</td>
<td>link=New Query</td>
<td>isPresent</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isPresent} == true</td>
<td>querycreationtestpass</td>
</tr>
<tr>
<td>click</td>
<td>"Test failed because new query wasnt created"</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>querycreationtestpass</td>
<td></td>
</tr>
This also shows up in the logs as
"Test failed because new query wasn't created"
which allows me to diagnose what went wrong

How to get information from selenium?

I am doing some test with Selenium IDE but I want to enter a value and get it after, is it possible ?
I have already tested the command store but it's not what I want...
Thanks
Get the text and store in a variable:
<tr>
<td>open</td>
<td>http://cnn.com</td>
<td></td>
</tr>
<tr>
<td>storeText</td>
<td>//h2[#class="banner-text banner-text--natural"]</td>
<td>buttonText</td>
</tr>
<tr>
<td>echo</td>
<td>${buttonText}</td>
<td></td>
</tr>

creating two grids one besides other each grid having each grid with two columns using dojo.

I want to have two grids one besides other. Each one of this grid having each grid contains two columns. I need complete source code for this using DOJO.
Basically i am comparing data between two employees. So i can compare data between two employees.
I already created one grid which display one employee data but failed to create another grid beside this employee. I need help with displaying two grids one besides other using DOJO
Have you tried to setup two different grids into two different Nodes.
Example:
<div id="emp1"> insert grid1</div> <div id="emp2">insert grid2</div>
Make two diffrent stores for the Grids and startup both seperatly.
Regards
<table dojoType="dojox.grid.DataGrid" id="table1">
<thead>
<tr>
<th width="300px" field="Title">
Title of Movie
</th>
<th width="50px">
Year
</th>
</tr>
<tr>
<th colspan="2">
Producer
</th>
</tr>
</thead>
</table>
<table dojoType="dojox.grid.DataGrid" id="table2">
<thead>
<tr>
<th width="300px" field="Title">
Title of Movie
</th>
<th width="50px">
Year
</th>
</tr>
<tr>
<th colspan="2">
Producer
</th>
</tr>
</thead>
</table>
then using js, add store to initialize it.
var table1 = dijit.byId('table1');
var store1 = new ...whatEverStore;
table1.setStore(store1);
//do same for table2
Hope this helps

How to automate DatePicker in Selenium IDE?

<tr>
<td>type</td>
<td>id=release_date</td>
<td>2012-09-30</td>
</tr>
This works but I don't want to type the date but pick it using DatePicker and try automating it.
This will vary greatly depending on how your datepicker is coded. For example, I'm working on a Web app that utilizes Dojo and I'm using the following code to select a specific position within the datepicker pop-up instead of a particular date (because the actual date isn't important for my tests):
<tr>
<td>waitForElementPresent</td>
<td>//*[#id="startDate"]</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=(//input[#value='▼ '])[3]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//table[#id='startDate_popup']/tbody/tr/td[4]/span</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//table[#id='startDate_popup']/tbody/tr/td[4]/span</td>
<td></td>
</tr>
I use waitForElementPresent frequently to make sure the JavaScript has time to complete running before the next step in the test is executed.
I've also found that clickAt is useful when clicking within Dojo widgets, and I typically prefer to use XPath for specific targets.
I hope this helps!
As newbie in Selenium IDE these days I done some tests who includes the date picker too.
I'll paste my HTML code, but if you have any problems or anything feel free to ask.
<!--Set some random generators for Hour From/To-->
<tr>
<td>storeEval</td>
<td>[Math.floor((Math.random() * 31) + 1)]</td>
<td>random</td>
</tr>
<tr>
<td>click</td>
<td>//select[#id='valid']/option[3]</td>
<td></td>
</tr>
<!--Add values to From date and To date-->
<tr>
<td>click</td>
<td>id=p_date_from</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=${random}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[#id='valid_period']/p[2]/span/span/abbr</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>[Math.floor((Math.random() * 10) + 1)]</td>
<td>random</td>
</tr>
<tr>
<td>click</td>
<td>link=${random}</td>
<td></td>
</tr>