I've been using Selenium to write some automated tests for my environment. Currently, I am declaring IWebElement variables that reference a web element by it's XPath. Would it be more efficient and better practice just to call the click/clear/send key functions from the WebDriver?
Current Method:
firefox = new FirefoxDriver();
IWebElement elem = firefox.FindElement(By.Xpath("//input[@type='text']));
elem.sendKeys("Hello StackOverflow!");
Alternative:
firefox = new firefoxDriver();
firefox.FindElement(By.Xpath("//input[@type='text'])).sendKeys("Hello Stackoverflow!");
I'd appreciate any advice and comments, thank you.
Aucun commentaire:
Enregistrer un commentaire