c# - Why does a link is clicked when test is run in Selenium IDE, but it is not clicked when the test is run by nunit.exe? -


i have following selenium test:

open    /dealerproducts.preprod/mainpage.aspx    type    id=uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtloginemail_i tester@gmail.com type    id=uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtpwd_i    pass123 clickandwait    css=#uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_btnlogin_cd > span     click   link=search contract     selectframe     id=contentplaceholder1_tabpages_frcontent1   pause       1000 click   id=grdlist_header2_colfilter_2_txtvalue1_2   type    id=grdlist_header2_colfilter_2_txtvalue1_2  pm10000130 click   css=span     click   id=grdlist_cell0_2_lnknumber_0 

when run test in selenium ide last link (id=grdlist_cell0_2_lnknumber_0) clicked. when following test (which above test exported c#) run nunit.exe last link isn't clicked:

[testfixture] public class elancetestwebdriver {     private iwebdriver driver;     private stringbuilder verificationerrors;     private string baseurl;     private bool acceptnextalert = true;      [setup]     public void setuptest()     {         driver = new firefoxdriver();         baseurl = "http://mysite.com/";         verificationerrors = new stringbuilder();     }      [test]     public void theelancetestwebdrivertest()     {         driver.navigate().gotourl(baseurl + "/dealerproducts.preprod/mainpage.aspx");         driver.findelement(by.id("uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtloginemail_i")).clear();         driver.findelement(by.id("uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtloginemail_i")).sendkeys("tester@gmail.com");         driver.findelement(by.id("uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtpwd_i")).clear();         driver.findelement(by.id("uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_txtpwd_i")).sendkeys("pass123");         driver.findelement(by.id("uctopbar_aspxroundpanel2_uclogin_cblogin_pnl_btnlogin_cd")).click();         driver.findelement(by.linktext("search contract"), 2).click();         driver.switchto().frame("contentplaceholder1_tabpages_frcontent1");         driver.findelement(by.id("grdlist_header2_colfilter_2_txtvalue1_2")).click();         driver.findelement(by.id("grdlist_header2_colfilter_2_txtvalue1_2")).clear();         driver.findelement(by.id("grdlist_header2_colfilter_2_txtvalue1_2")).sendkeys("pm10000130");         driver.findelement(by.cssselector("span")).click();         iwebelement el = null;         el = driver.findelement(by.id("grdlist_cell0_2_lnknumber_0")); //.click();         assert.that(el != null); // 1.         driver.findelement(by.id("grdlist_cell0_2_lnknumber_0")).click();     } 

element id=grdlist_cell0_2_lnknumber_0 found when runing above test because assert 1. never fails. strangely when test run step step in debug mode in visual studio link clicked. html of link:

<a class="dxehyperlink" onclick="aspxseclick('grdlist_cell0_2_lnknumber_0', event)" id="grdlist_cell0_2_lnknumber_0" style="font-size:9px;">pm10000130</a> 

can tell me why link isn't clicked when test run nunit.exe or nunit-x86.exe?

i found solution, had add

thread.sleep(new timespan(0, 0, 3)); 

before clicking link.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -