How to select the values from Data grid by using click event?

In our application, we have Popup screen. While click on the Search button, the popup screen will be displayed. From the Data Grid we need to select the records using click action. Then we need to pass the values to the Parent screen.

Default Asked on November 4, 2014 in Selenium WebDriver.
on November 4, 2014.
Add Comment
  • 2 Answer(s)

    HI Anand,

    If it is a Modal Window, then you do not need to be use the switch command. Just get the id or xpath of it and do your operations on it. Modal window is always a part of same html page. Make sure you use the thread.sleep() before clicking any element on Modal window, as it is generated with the java script and sometime it takes one or more seconds to appear on the page but Selenium did not understand this delay, as it is a same page and it tries to perform action with in fractions of second and it got failed.
    Example of modal window, most of the time it covers the background with transparent black wallpaper and on top it the window display.

    If it is a Pop window, then you may need to switch the window.

    Please send us the screen shot of the pop up. But it should not be a pop up, as I am not sure if the pop is able to display the complex data grid.

    Lakshay Sharma

    Professor Answered on November 4, 2014.
    Add Comment

    Hi Lakshay Sharma,

    Thanks for your kind mail. The details are as follows:

    RE: How to select the values from Data grid by using click event?

    While click on the “Search Button” – the Popup will be displayed.

    Pop up screen image.

    RE: How to select the values from Data grid by using click event?

    Step to Produce:

    Click on the Search button (Parent Screen)  (Pop up will be displayed)
    From the Pop up screen – we need to select the Customer Name dynamically. (Child Node )
    Then the selected Customer Name should be displayed in the “Parent Screen”

    Is it possible to give the code for the same.

    Thanks in advance.

    Anand G

    Default Answered on November 4, 2014.

    Please send the xpath of the cell of the table. For e.g. xpath for “7 Hills” & “Jack”. And complete xpath of Seach botton. Or if possible paste a screen shot of the HTML as well with locating the Cell element on it.

    on November 5, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.