A particular scenario doesn't gets recorded in Selenium IDE - 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.

Related

Pressing Enter on a date input in Cypress

I have an app with some input fields that I'm trying to automate. The gist of these fields is that I should be able to double click a field, type in a new value, then press Enter to submit that value, which sends a PUT request and also closes the input field. This works for any input type except date.
So far I've tried:
Using cy.type('{enter}'). This gives Typing into a date input with cy.type() requires a valid date in the format 'yyyy-MM-dd'. You passed: {enter}
Using cy.trigger() to send out a keydown event for the enter key. This works, as in it closes the input field successfully but it somehow doesn't send the PUT request.
Pressing enter on the parent Element. Same as using cy.trigger()
Strangely enough, manually opening the input field myself, typing a date and pressing enter will send the request just fine. It seems to me like there's some issue with programmatically pressing enter to submit the field without Cypress interpreting this as my attempt to actually type an invalid character into the date field. The docs do specifically say that no special characters are allowed in a date field.
Can't post any code as this is corporate.
I have tried to let it work, but it simply can't be done at the moment. Something like this should work:
it.only('test', function () {
cy.visit('https://www.html5tutorial.info/html5-date.php')
cy.get('input')
.type('2009-12-12')
.type('{enter}')
})
But it doesn't so I started to dig into the pile of issues and found this one:
https://github.com/cypress-io/cypress/issues/3405 . It is about a different input type, but I believe it is related to your problem.
Unfortunately this problem is still present in Cypress 9.5. One possible work-around is to directly trigger the Javascript keyup or keydown event that you are listening for.
cy.get('input')
.type('2020-01-01T12:00')
.trigger('keydown', {
key: 'Enter',
});
This works for me, but as you pointed out might not in all situations. It depends entirely on how your app is listening for Enter in the first place and on which element.
Another possible option is to call .submit() on the form that wraps the input. If you're testing a component, you could create your own wrapper component that contains a form in order to trigger the submit.
You should remove 'date' attribute like below:
cy.get('input').invoke('removeAttr','type').type('2009-12-12{enter}');
I used something like that in my code, and it worked properly
cy.get('get-your-input').invoke('removeAttr', 'type')type('2022-12-01{enter}').trigger('change');
cy.get('get-your-input').invoke('attr', 'value', '2022-12-01').trigger('change');
cy.get('get-your-input').invoke('attr', 'type', 'date');
Please add date plus enter keystroke in the type: cy.get("#date").type("02-02-2022{enter}");

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.

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.

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.