Customizing Custom library methods

In last post of Refactoring custom methods of control libraries, we discussed how to

  • Reduced number of parameters
  • Strongly-typed parameters
  • More reusable

In this post, we will discuss reducing the number of parameters even further to more granular level after the introduction of Page Object Model in our code, please read my previous post for more details on POM

Here is the complete video for the above discussion

Here is the complete code

Set Methods for controls like Textbox, Button, DropDownList box.

Get Methods for controls like Textbox and DropDownList box

Thanks for watching the video and reading the post!!

Please leave your comments and let me know if there is anything need to be improved in the post!!!

Thanks,
Karthik KK

5 comments

  1. Justin says:

    Hi,

    I tried your POM example code to select dropdown list using telerik RadComboBox but got
    NoSuchElementException: Cannot find element by: By.Id

    The aspx code for the RadComboBox is below. The selections are dynamically generated from the dropdown when click the arrow to view list.

    Can you please provide a sample code example?

    Select Study / Site

    select

    • Justin says:

      The html code did get posted. Please see below..

      div class=”content-left-box”>
      div class=”content-left-box-text”>
      h3>Select Study / Site
      div>
      ul>
      li>
      div id=”ctl00_ContentPlaceHolderLeft_ArcosLeftColumn_rcbProtocol” class=”RadComboBox RadComboBox_Default” style=”width:160px;”>
      table class=”” style=”border-width: 0px; border-collapse: collapse;” summary=”combobox”>
      tbody>
      tr class=”rcbReadOnly”>
      td class=”rcbInputCell rcbInputCellLeft” style=”width:100%;”>
      input id=”ctl00_ContentPlaceHolderLeft_ArcosLeftColumn_rcbProtocol_Input” class=”rcbInput radPreventDecorate rcbEmptyMessage” type=”text” readonly=”readonly” value=”Select Study / Site” name=”ctl00$ContentPlaceHolderLeft$ArcosLeftColumn$rcbProtocol” autocomplete=”off”>
      /td>
      td class=”rcbArrowCell rcbArrowCellRight”>
      /tr>
      /tbody>
      /table>
      div class=”rcbSlide” style=”z-index: 6000; display: none; width: 310px;”>
      input id=”ctl00_ContentPlaceHolderLeft_ArcosLeftColumn_rcbProtocol_ClientState” type=”hidden” name=”ctl00_ContentPlaceHolderLeft_ArcosLeftColumn_rcbProtocol_ClientState” autocomplete=”off”>
      /div>
      /li>
      /ul>
      /div>
      /div>
      /div>

Leave a Reply

Your email address will not be published. Required fields are marked *