C# selenium - WebDriver wait not waiting -


i'm using page object model design selenium tests. i'm having few issues wait code in keywords below. when call keyword in nunit test using code such below trys click on button before ready. if paste same wait code in nunit test waits expected , clicks button. preference have keywords implement take care of waits , not have write in test. missing here?

nunit test

public void quotespagetest()         {              //loginto crm             loginpage loginpage = new loginpage();             loginpage.userlogin();              //select quotes tile             pgcommon mymenu = new pgcommon();             mymenu.gotomenu("quotes");               //click new             pgquotes quotespage = new pgquotes();                      keywords.dosendkeys(quotespage.btnnew);                      } 

keywords.cs

using openqa.selenium; using openqa.selenium.support.ui; using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace traingday1_1 {     public static class keywords     {         public static void dosendkeys(this iwebelement element)         {             string elementname = element.getattribute("value");             webdriverwait wait = new webdriverwait(globaldriver.driver, timespan.fromseconds(environmentdata.objecttimeout));                         wait.until(expectedconditions.elementtobeclickable(element));             element.sendkeys(keys.enter);             console.writeline("selected " + elementname + " , pressed enter key");          }          public static void doclick(this iwebelement element)         {             string elementname = element.getattribute("value");             webdriverwait wait = new webdriverwait(globaldriver.driver, timespan.fromseconds(environmentdata.objecttimeout));             wait.until(expectedconditions.elementtobeclickable(element));             element.click();             console.writeline("selected " + elementname + " , pressed enter key");          } 


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -