Selenium IDE not recording Dijit Combo Values - selenium

I have an application which uses Dijit Combobox. What happens is, I click on the cell. It opens up a dropdown. This is getting properly recorded in the IDE. But, when I choose a value from the drop down, IDE is not recording that part.
Here is the firebug screenshot of the combo box that appears on clicking on the cell. As you can see it has two values cm2 and mat1. I need the IDE code to choose either of these values.
I tried something like
click - //div[#id='csi_table_Widget_5']/div[2]/table/tbody/tr/td[11] This works fine for opening the drop down.
click - //div[#id='widget_csi_widget_FilteringSelect_10_dropdown']/ul/li[4]
This does not work for choosing a value from the drop down.
Any help, please?

If you absolutely have to click the value, then I think you need to check the ID you are using. Based on the DOM you should be using //div[#id='csi_widget_FilteringSelect_10_dropdown']... instead of widget_csi_... I'm not sure a selector on widgetid would work in selenium.
Alternatively, if you know what value you will be entering into the combo, you could use selenium.type for all but the last character you need to enter, and then selenium.keyPress for the last one. This will fire dojo's change method and select the value in question, unless there is more than one matching the string provided.

Related

How to unfocus from all inputs/elements in Selenium without tabbing out

I have a form where I fill in textboxes through selenium (java). Some of the textboxes dynamically generate extra content when you click on them and remove the content when you focus on something else. This is a problem when I automate because if I am focused on a text box and try to click on something else, when the page removes the content it doesn't register my click and I need to click again. This leads to flakey behaviour since I need to now consider whether I need to click or double click a button depending on what element I was focused on before.
I can't send a tab key to the text box because sometimes it will tab into another textbox that has the same dynamic generation behaviour, leading to the same scenario as before.
I tried clicking the page element but it also doesn't seem to work. I also tried clicking the root div. It just doesn't seem to register my click (I also tried jsclicks)
What I would like to do is have a general way to unfocus a text box after I fill it.
Thanks!

Selenium Find Element by xpath using value as well

I am trying to check to see if buttons are present on a page. The number of buttons varies depending on the type of account that logs in. The code below returns true, so I know that the xpath is working.
Boolean WorkspacePresent = driver2.findElement(By.xpath("//body/div[2]/div[1]/div[1]/form[1]/section[1]/input[1]")).isEnabled();
However, I need to make sure that the value is also included, since this just checks how many buttons are there. If I wanted to check for a "Workspace" button, could I still use Find By Xpath?
To identify the Workspacebutton button use following xpath.Similar way you can identify other button.
driver2.findElement(By.xpath("//input[#name='Workspacebutton' and value='Workspace']"))

Input type search clear button Microsoft Edge not working properly with Datatables

I am using Datatables to sort and filter my tables. When you activate Datatables, there is a search field. In Chrome, Firefox, Edge and Internet Explorer 11 there is a clear button present with every search input field.
When you click on it, the text is cleared and the table will reset. Except in Microsoft Edge, this does not work. The table is not resetting.
Is this an issue with Microsoft Edge or Datatables?
I believe it is Edge that not is triggering the events the DT input is listening on. That is keyup, keydown, keypress, cut and paste ...There is two additional events that is fired when you click on the search input clear button: mousedown and mouseup.
You could create event handler that force a redraw when mouseup is triggered :
$('.dataTables_filter input').on('mouseup', function() {
table.draw()
})
See this question where the issue is discussed more thoroughly -> Event fired when clearing text input on IE10 with clear icon
This is a known bug found in build 17.17134 of Edge.
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17584515/
I am using an earlier version and it still works.
I try to make a test on my side with EDGE and got the same result like yours.
When click on 'X' it is not reset the table.
Click here to see testing result
Then i made some other tests and find that if you use BackSpace key to clear the search text then it will work as expected.
If you use 'X' button then after text get clear you need to press enter to reset the data.
I agree with other community members that Edge is not triggering the event to reset data.
I think you need to submit your feedback to Datatables site. So that they modify their code which can work properly with Edge.
Regards
Deepak

In a group check box is it possible to select an option by clicking anywhere in the screen and not exactly inside the check box?

From a group check box is it possible to select only one option. And I want to know whether a particular option can be selected without exactly clicking inside the check box. i,e Is it possible to select an option by just clickig somewhere in the screen where the text of the option is displayed.
I was testing an application and i found that it was able to select an option even without clicking inside the check box, so wanted to know whether that is a validation bug!!
I do not think that it is a bug if there is only one radio button or check box on the screen. Such type of functionality is sometimes provided in order to provide extra functionality to the user. There are certain validations that are capable to do this. But if there are multiple check boxes or radio buttons on the screen then it must be a bug. Because in case of multiple check boxes on the screen the script does not know which button to check.

Cannot click Submit button on Selenium IDE

I am having trouble getting Selenium IDE to click the Submit button on one of my webforms after having selenium open and fill out the form. I am using the clickAndWait command and identifying the button by its ID:
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_OSVFHResults_btSave</td>
<td></td>
Interestingly, if I write a script that simply opens the form and clicks the submit button without filling it out, I am not having any problems. My problem is coming specifically after I've asked Selenium to fill out the form. Additionally, if I try to manually click the submit button, it doesn't work if the Selenium script to fill out the form was run before my manual input. If I manually open and fill out the form, I have no problems clicking submit, and Selenium works for all of the other form's submit buttons on the site. Anyone have any ideas?
Instead of filling form with type command you can try typeKeys one. It simulates keystroke events on the specified element, as though you typed the value key-by-key and probably enable your submit button.
It sounds like some javascript event unrelated to click() (such as mouseover or onkeydown) is attached to one or more of the form fields and is responsible for enabling the submit button.
You'd have to look at which exact events are being fired, either by looking at the source with something like firebug, or by using a javascript debugger. Then modify your Selenium script to make sure the same events get triggered.
After type the values in the form just try "ClickAtandWait" instead of "clickandWait"..i also face the problem once and it gave hands once..
selenium.clickAtandWait("locator", "position");
if you know the exact "position" just put it, otherwise leave it as an empty string.