Attempting to verify disabled text with Selenium IDE - 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

Related

SuiteCRM turn ON autocomplete on email recipient field

I'm trying to remove the autocomplete="off" attribute from the input field for the email recipient field
The code of the input field is as follows:
<input
class="ac_input yui-ac-input"
size="96"
id="addressTO1"
title="An"
name="addressTO1"
onkeyup="SE.composeLayout.showAddressDetails(this);"
autocomplete="off" type="text">
Is there a setting that can be accessed via the GUI that changes the behaviour of the email "to" field or what would be the best way to turn on the autocomplete functionality.
Just removing it does not work, as there is some javascript functionality there, that keeps bringing it back.
I'm using suiterCRM version 7.6.5
Sugar Version 6.5.23.
There is no GUI for changing that, the autocomplete=off is hardcoded.
The TO field (addressTO1 dynamically generated name) is not a regular text input field, it will support multiple emails separated by comma, so a autocomplete="email" will not work.
The only solution I could come up with is for you to create a javascript function and attach to the keyup event of the field and show your logic.
Also you will need to save previously filled input with the answers and provide a mechanism to delete that. Not an easy solution I am afraid.

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.

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.

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

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.

Verify input text element is not empty in Selenium IDE

How can I verify that an input element has any text in it. It is loaded with random text so I can't verify a specific value, but there must be some text in it.
I'm using Selenium IDE
In Selenium IDE you can use the verifyEval command and a bit of JavaScript to verify that a field is populated, or not.
Command: verifyEval
Target: this.page().findElement("//input[#id='email']").value != ''
Value: true
In this case, I'm testing that the <input type="email" id="email" value='address#domain.com"> is not an empty field on my HTML page.
When this command is run, the JavaScript code in the target is evaluated. Here it is testing the current value of the email field against an empty string. If they don't match (e.g. the field isn't empty) then it true is returned. This return value is then compared to the expected Value which is also true and so the test passes.
I just use
verifyNotValue|//input[#id='email']|
the 3rd param is empty
This should be a cinch if you use Selenium-RC with any programming language. However, given that you are using the IDE, I would recommend adding this user extension. This will give you some looping constructs. You can use storeText and then take a decision based on the value of the variable in which the retrieved text is stored. The Stored Vars is another useful IDE firefox extension for analyzing the contents of the storeText variable.
Try this:
driver.find_element_by_id("email").get_attribute("value") != ''
It was part of a sign up form assertion.
The firstName field was provided with data. Then i used the following code to verify whether the field was filled up with data.
if(driver.findElement(By.cssSelector("#FirstName")).getText()==""){
System.out.println("field didn't fillup with data");
}
else {
System.out.println("field filled up with data");
}