How to click on a button that does not have an id? - testing

I want to click on a button that does not have id. This button has a class name - ImageButton.
Also, the button is located on the tollbar
I can not do this because I do not have id
onView(...).perform(click());
Trying to use Baristo, but this does not work:
click(withClassName(ImageButton.class));

Related

Selenium: how to handle dropdown overlapping that is preventing from clicking on to next element

I'm trying to select a list option from the dropdown by sending text (ie; one of the option is: "MyName") to search bar for the dropdown option, (typeAheadInputSelection). After enter the text the selection is typed on the search bar and option is highlighted, however, the highlighted drop down list does not disappear after hitting enter button.
I'm able to type text and press enter (or tab) however, the selected dropdown overlaps and unable to move onto next web element to take actions.
I have tried below code:
IWebelement webElement= driver.FindElement(By.Id("userType");
webElement.SendKeys("name" + Keys.tab)

How to change an embedded image on a command button?

I have a button with an image on it. It's an embedded picture taken from the picture property in the Picture Builder dialog. The image is named "Sort Descending" in the Picture Builder dialog.
When the form loads, the sort is Ascending on the field. When the user clicks on the button, the recordset is sorted Descending.
I need to change the image programmatically to the "Sort Ascending" image that is in the Picture Builder dialog.
I'm thinking it's in one of the system databases.
You can create a global variable and change its value each time the user clicks the button. Then change the picture based on the value
Something like:-
In a module:
Option Explicit
Global booSorted As Boolean
Then in the button onClick event
Private Sub cmdBtnName_Click()
If booSorted=True then
booSorted=False
Me.cmdBtnName.Picture = "ImagePath1"
Else
booSorted=True
Me.cmdBtnName.Picture = "ImagePath2"
End if
End Sub

Unable to Click on Edit Button , in WebTable

I am using xpath to click on edit button , but i dont know where the webtable starts so i can click on the webelement.
Below is the link for WebTable.
http://demo.automationtesting.in/WebTable.html
Thanks in Advance.
Try this:
// gets the first edit button
WebElement Edit_btn= driver.findElements(By.xpath("//div[#class = 'avddbl']/button")).get(0);
Actions action = new Actions(driver).doubleClick(Edit_btn);
action.build().perform();
If you want some specific selection e.g. want to edit info of particular user
Then you can use below xpath where you have to changes email address only it will click on the edit icon of that particular record .
//div[text()='steven#hotm.com']/../following-sibling::div//div[#class='avddbl']/button[contains(#class,'btn')]

VB.net Form Assign Tab Index with Tab Control in between

I have, First Field on Main Form then Tab Control with Some Fields and then Some Buttons again on Main Form
I have Set Tab Index , First Field on Main Form = 1, Field in Tab Control = 2, Button on Main Form = 3
But my tab goes from First Field to Button , it does not go to Tab Control Field
Is there anyway it should follow first field and then field in tab control and then to buttons
Thanks
Pramod
Open your form in the design mode.
Click on "View" from the top menu and then click "Tab Order".
You will see that the controls on the form takes a numbers like this:
Now click the controls one by one as order as you need.

Get the value of a cell on a ASPXGridview based on the button click

I have a ASPXGridview with a button as the first column for each of the rows. When I click a button I want it to perform a callback which will get me the value of the cell next to the button click. I'm a bit stuck on this so any advise would be great.
Thanks
I created a call back function to get key field name from a row on selection changed.
Then when I click on the button is gets the selected keys on the page.