Selenium IDE: Problem to record input value with dynamic security prefix - selenium-ide

I want to use selenium to record and click at item in a page with the following code:
<input type="checkbox" onclick="HighlightRow(1, this, 3,"");" value="916242540932034325|628149" name="AID">
in Selenium IDE, recorded script:
click
//input[#name='AID' and #value='916242540932034325|628149']
However, the value 916242540932034325|628149
having security prefix "916242540932034325" which will change dynamically every time the page load.
Problems: My Recorded Script not able to RUN after page load due to the dynamic security prefix.
Help: Anyone have any suggestion for the problems I face above?

Try click //input[#name='AID' and contains(#value, '|628149')]. As long as that's a unique combination of NAME and VALUE, you'll get what you want.

Related

A particular scenario doesn't gets recorded in Selenium IDE

I have a field where numerals can be entered in a particular way only. It will allow only 4 numerals. Initially the field is blank.
On clicking inside the field there is a separator **:** After entering numerals it will be like 12:12. I don't know to mention what type of text box it is (Like autocomplete or free form)
While recording using IDE these actions are not getting recorded. I tried to write by my own. But cannot see any helpful links. I'm a newbie to Selenium.
Checked using F12.
Can see as below
<input value ="" tabindex="10" maxlength="5" data-type="time" class="FormField textbox1" onfocus="return addTimePicker(this)" onblur="return checkTime(this)" type="text">
I got a solution like this :
Command : type
Target : xpath=/html/body/form/div[4]/div[4]/table/tbody/tr[4]/td/table/tbody/tr/td[1]/table[1]/tbody/tr/td/div/table/tbody/tr/td/div/div[2]/div[2]/ul/li[2]/input[1]
Value :
1010
Then I need to write another command again. Else the value wont be retained. Field is restricted in such a way.
Command : click
Target : xpath=/html/body/form/div[4]/div[4]/table/tbody/tr[4]/td/table/tbody/tr/td[1]/table[1]/tbody/tr/td/div/table/tbody/tr/td/div/div[2]/div[2]/ul/li[2]/input[1]
Is there any way to combine these two commands. The action i would like to perform is type in and then click inside the same field.

Attempting to verify disabled text with Selenium IDE

I am attempting to verifyText of a text box programmatically populated then is disabled from user editing. Firebug gets me to this code.
<div class="flexitem-center">
<input class="input-default" type="text" disabled="" value="20140201"/>
I can locate the text box but I can't figure out how to verify against the value attribute. I am fairly new to Selenium and only use the IDE not web driver.
I have found guru99.com "How to use Locators in Selenium IDE" to be real helpful, but I could not find and answer for this. The same goes with seleniumhq.org/docs/
I haven't found any examples of verifying the value attribute. Maybe I can't get there from here?
My most recent attempt is
<td>verifyText</td>
<td>css=input.input-default[value=20140201]</td>
<td>20140201</td>
That generates an error - Actual value " did not match '20140201'
Thanks for any help.
First of all if you can find an element by locator = css=input.input-default[value=20140201] you are already sure that the input with such value exists (because it is included to locator). So you can do:
click | css=input.input-default[value=20140201]
And it will fail if there will be no element with such value
Secondly value is not the same thing as text. Value is an attribute of input. If you need to verify attribute value just do it:
verifyAttribute | css=input.input-default[value=20140201]#value | 20140201

In Selenium IDE create node text title not found and give the error

Generate error Image screenshot :
I am also use command and run that i.e. type, typeAndWait, typeKeys, typeKeysAndWait , also give the error
Selenium IDE:
Command : Target
type : id=ctl00_Dialogproxy_deletenews_btnDelete
Reference box give the message text :
type(locator, value)
Arguments:
locator - an element locator
value - the value to type
Sets the value of an input field, as though you typed it in.
Can also be used to set the value of combo boxes, check boxes, etc. In these cases, value should be the value of the option selected, not the visible text.
I am send the image URL for all details
Edit: Image was hidden so make it visible.
This looks like it is again a duplicate of the issue you've noted in In Selenium IDE btnDelete (Button) not found
You follow up a "click" that loads a dynamic pop up with an action on a new element. It's possible that selenium is moving to fast for the pop up and the new elements are not in the DOM yet for selenium to access.
I suggest using a "waitFor" action, such as waitForElementPresent. You can also see if this is a case by inserting a pause (with 5 or 10 seconds). I do not recommend pause since it's a hard stop where as a waitFor command will take the minimum amount of time it needs.

Passing form value in joomla

I would like to upgrade one of my joomla 2.5 plugin (self-developed). It is a complex task, but here is this specific issue I couldn't solve. I would like to put an input field with a submit button at my articles (done), and after submitting I want to get it. So simple.
Here is the outline of the code:
The form:
<form action="" method="post">
<input type="text" name="info">
<input type="submit" value="ok">
</form>
The process:
$jinput = JFactory::getApplication()->input;
$foo = $jinput->get('info', '444');
print_r($foo);
Basically it should work, but somehow I don't get the value, always recive the default value '444'. If I change the action to an external php file, and process in php-way, it works.
What I checked so far:
a. change form method to GET. Result: the needed value appears properly in the article's URL, but still print the default value '444' not the value I see in the URL (if the default value isn't set, it doesn't print anything).
b. pass the value to an external .php file, store in session, and echo the session value in the article, but empty again.
Maybe I will force to get the GET values by exploding the $_SERVER["REQUEST_URI"], but I can't sleep until I find out what could be wrong with desired process.
Anyone can help?
UPDATE: maybe important - I use K2 plugin.
So far I could figure out the following:
it is a special case. On my local server the code works fine both with normal joomla articles and K2 component articles.
on my website the code also works fine with normal joomla articles, so it is defenietly a K2 settigns-issue.
there was a chance the problem is related to K2 advanced SEF settings (specifies the url of the K2 item), but it isn't. The problem is on my website, so I used on my localhost-version the SEF settings of the website-version, and I recived the values fine. == not K2 advanced SEF settings problem.
This is the answer for my question: "should find which K2 setting is causing the problem"
UPDATE. Solution: turn off caching at global configuration, so the page isn't loading from cache. In cache are no given values stored - obbbbbviously.

Eclipse: "Simple" Template Problem with ${word_selection}

i got a (hopefully) simple problem with a Code Template on Eclipse. I try to use a Code Template to surround a word with somehing. The Replacement is nearly successful, but i have a problem with handling the selected word.
My task is to select "save " on this example
<button type="submit">save</button>
and want to have
<button type="submit"><?= $this->_('save') ?></button>
The problem is, that i got this after replacement
<button type="submit">save<?= $this->_('save') ?></button>
Is there a possibility to remove the selected word after using a code template? I am thankful for every help i get. Smile
I forgot, the template looks like this:
<?= $$this->_('${word_selection}') ?>${cursor}
Maybe this question is somewhat old, but I came across the same idea in Java for adding String constants by simply typing the desired name and then replace it with a template, like this for example:
type VALUE and get it replaced with private static final String VALUE = "VALUE";
I use eclipse 3.6 and got it working with the following template:
private static final String ${word_selection} = "${word_selection}";
Then I do the following steps:
type VALUE
select it by double-clicking and hit CTRL+SPACE
enter first few chars for the template name in the opened proposal pop-up and select the template (see image below)
hit ENTER
And the result is this:
Maybe this is helpful.
Using templates and the ${line_selection} or ${word_selection} variables, Eclipse (Helios, 3.6.1 here) always seems to insert the rendered template after the text you initially selected.
I've experienced this myself (in the HTML editor) while trying to implement a similar 'Surround with Tag' template, and gave up and reverted to using Ctrl+1 (after selecting text), and using 'Surround with new element...'. Unfortunately this workaround doesn't help you much w/ PHP.
Possible bug report?
I also faced the same problem in jsp page. I resolved this issue by using 4 or more characters to select the template in eclipse. And I got the correct result.