Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've found PageObject pattern very helpful. </p> <p><a href="http://code.google.com/p/webdriver/wiki/PageObjects" rel="nofollow noreferrer">http://code.google.com/p/webdriver/wiki/PageObjects</a> </p> <p>more info: - <a href="https://stackoverflow.com/questions/616810/whats-the-point-of-selenium/616887">What&#39;s the Point of Selenium?</a> - <a href="https://stackoverflow.com/questions/99876/selenium-critique/211452">Selenium Critique</a></p> <p>maybe a good way to start is to incrementally refactor your test cases.</p> <p>I use the same scenario you have selenium + c#</p> <p>Here is how my code looks like:</p> <h2>A test method will look like somethink like this</h2> <pre><code> [TestMethod] public void RegisterSpecialist(UserInfo usrInfo, CompanyInfo companyInfo) { var RegistrationPage = new PublicRegistrationPage(selenium) .FillUserInfo(usrInfo) .ContinueSecondStep(); RegistrationPage.FillCompanyInfo(companyInfo).ContinueLastStep(); RegistrationPage.FillSecurityInformation(usrInfo).ContinueFinishLastStep(); Assert.IsTrue(RegistrationPage.VerifySpecialistRegistrationMessagePayPal()); selenium.WaitForPageToLoad(Resources.GlobalResources.TimeOut); paypal.LoginSandboxPage(usrInfo.sandboxaccount, usrInfo.sandboxpwd); Assert.IsTrue(paypal.VerifyAmount(usrInfo)); paypal.SubmitPayment(); RegistrationPage.GetSpecialistInformation(usrInfo); var bphome = new BPHomePage(selenium, string.Format(Resources.GlobalResources.LoginBPHomePage, usrInfo.AccountName, usrInfo.Password)); Assert.IsTrue(bphome.VerifyPageWasLoaded(usrInfo)); Assert.IsTrue(bphome.VerifySpecialistProfile()); bphome.Logout(); } </code></pre> <h2>A page Object will be something like this</h2> <pre><code>public class PublicRegistrationPage { public ISelenium selenium { get; set; } #region Constructors public PublicRegistrationPage(ISelenium sel) { selenium = sel; selenium.Open(Resources.GlobalResources.PublicRegisterURL); } #endregion #region Methods public PublicRegistrationPage FillUserInfo(UserInfo usr) { selenium.Type("ctl00_cphComponent_ctlContent_wizRegister_tUserFirstName", usr.FirstName); selenium.Type("ctl00_cphComponent_ctlContent_wizRegister_tUserLastName", usr.LastName); selenium.Select("ctl00_cphComponent_ctlContent_wizRegister_ddlUserCountry", string.Format("label={0}",usr.Country )); selenium.WaitForPageToLoad(Resources.GlobalResources.TimeOut); selenium.Type("ctl00_cphComponent_ctlContent_wizRegister_tUserEmail", usr.Email ); selenium.Type("ctl00_cphComponent_ctlContent_wizRegister_tUserDirectTel", usr.DirectTel); selenium.Type("ctl00_cphComponent_ctlContent_wizRegister_tUserMobile", usr.Mobile); return this; } </code></pre> <p>}</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload