Closed aaronportier closed 10 years ago
Generally speaking, this should be possible. I assume that the element gbqfq is the input box and gbqfb is the submit button. I don't know Google's homepage very well, but I do know that it contains some nifty javascript. Not sure if it depends on that though.
Could you try to do the same thing with Firefox/Chrome with javascript disabled? See what happens then?
Teun Op 19 mei 2014 02:36 schreef "aaronportier" notifications@github.com:
Not sure if this is the right place or not? I get no element found for wd.FindElement(By.Id("gbqfq")).Click(); this is all the code: [TestClass] public class UnitTest3 { [TestMethod] public void Debit_WithValidAmount_UpdatesBalance() { //IWebDriver wd = new RemoteWebDriver(DesiredCapabilities.Firefox()); IWebDriver wd = new SimpleBrowser.WebDriver.SimpleBrowserDriver(); try { wd.Navigate().GoToUrl("https://www.google.com/"); wd.FindElement(By.Id("gbqfq")).Click(); wd.FindElement(By.Id("gbqfq")).Clear(); wd.FindElement(By.Id("gbqfq")).SendKeys("fiserv"); wd.FindElement(By.Id("gbqfb")).Click(); if (!wd.FindElement(By.TagName("html")).Text.Contains("Fiserv: Financial Services Technology, Mobile Banking ...")) { Console.Error.WriteLine("verifyTextPresent failed"); } } finally { wd.Quit(); }
— Reply to this email directly or view it on GitHubhttps://github.com/Teun/SimpleBrowser.WebDriver/issues/21 .
I've checked the page. If you load without javascript enabled, the elements you try to use are indeed not on the page. There is an input field with name q (no id) and a input[type=submit] with name btnG. If you use those, I'm sure it will work.
However, if you want to use Google's homepage like real users would, SimpleBrowser is not your tool. You could look into PhantomJS, which does include javascript support. It adds some overhead (because it will have to download and parse those scripts too, making it only a bit faster than just using Chrome).
Teun Op 19 mei 2014 07:55 schreef "Teun Duynstee" teun@duynstee.com:
Generally speaking, this should be possible. I assume that the element gbqfq is the input box and gbqfb is the submit button. I don't know Google's homepage very well, but I do know that it contains some nifty javascript. Not sure if it depends on that though.
Could you try to do the same thing with Firefox/Chrome with javascript disabled? See what happens then?
Teun Op 19 mei 2014 02:36 schreef "aaronportier" notifications@github.com:
Not sure if this is the right place or not? I get no element found for wd.FindElement(By.Id("gbqfq")).Click(); this is all the code: [TestClass] public class UnitTest3 { [TestMethod] public void Debit_WithValidAmount_UpdatesBalance() { //IWebDriver wd = new RemoteWebDriver(DesiredCapabilities.Firefox()); IWebDriver wd = new SimpleBrowser.WebDriver.SimpleBrowserDriver(); try { wd.Navigate().GoToUrl("https://www.google.com/"); wd.FindElement(By.Id("gbqfq")).Click(); wd.FindElement(By.Id("gbqfq")).Clear(); wd.FindElement(By.Id("gbqfq")).SendKeys("fiserv"); wd.FindElement(By.Id("gbqfb")).Click(); if (!wd.FindElement(By.TagName("html")).Text.Contains("Fiserv: Financial Services Technology, Mobile Banking ...")) { Console.Error.WriteLine("verifyTextPresent failed"); } } finally { wd.Quit(); }
— Reply to this email directly or view it on GitHubhttps://github.com/Teun/SimpleBrowser.WebDriver/issues/21 .
Terun,
I have been attempting to work with the project for a while(I love the ideas behind it) and have not been able to figure it out. I have a few questions for you if you will?
Thank You very much for any help.
Aaron
On Mon, May 19, 2014 at 2:23 AM, Teun notifications@github.com wrote:
I've checked the page. If you load without javascript enabled, the elements you try to use are indeed not on the page. There is an input field with name q (no id) and a input[type=submit] with name btnG. If you use those, I'm sure it will work.
However, if you want to use Google's homepage like real users would, SimpleBrowser is not your tool. You could look into PhantomJS, which does include javascript support. It adds some overhead (because it will have to download and parse those scripts too, making it only a bit faster than just using Chrome).
Teun Op 19 mei 2014 07:55 schreef "Teun Duynstee" teun@duynstee.com:
Generally speaking, this should be possible. I assume that the element gbqfq is the input box and gbqfb is the submit button. I don't know Google's homepage very well, but I do know that it contains some nifty javascript. Not sure if it depends on that though.
Could you try to do the same thing with Firefox/Chrome with javascript disabled? See what happens then?
Teun Op 19 mei 2014 02:36 schreef "aaronportier" notifications@github.com:
Not sure if this is the right place or not? I get no element found for wd.FindElement(By.Id("gbqfq")).Click(); this is all the code: [TestClass] public class UnitTest3 { [TestMethod] public void Debit_WithValidAmount_UpdatesBalance() { //IWebDriver wd = new RemoteWebDriver(DesiredCapabilities.Firefox()); IWebDriver wd = new SimpleBrowser.WebDriver.SimpleBrowserDriver(); try { wd.Navigate().GoToUrl("https://www.google.com/"); wd.FindElement(By.Id("gbqfq")).Click(); wd.FindElement(By.Id("gbqfq")).Clear(); wd.FindElement(By.Id("gbqfq")).SendKeys("fiserv"); wd.FindElement(By.Id("gbqfb")).Click(); if (!wd.FindElement(By.TagName("html")).Text.Contains("Fiserv: Financial Services Technology, Mobile Banking ...")) { Console.Error.WriteLine("verifyTextPresent failed"); } } finally { wd.Quit(); }
— Reply to this email directly or view it on GitHub< https://github.com/Teun/SimpleBrowser.WebDriver/issues/21> .
— Reply to this email directly or view it on GitHub https://github.com/Teun/SimpleBrowser.WebDriver/issues/21#issuecomment-43469380 .
I've added a wiki page with links and some tips. I hope this answers your questions.
https://github.com/Teun/SimpleBrowser.WebDriver/wiki/Developing-with-SimpleBrowser.WebDriver
Not sure if this is the right place or not? I get no element found for wd.FindElement(By.Id("gbqfq")).Click(); this is all the code: [TestClass] public class UnitTest3 { [TestMethod] public void Debit_WithValidAmount_UpdatesBalance() { //IWebDriver wd = new RemoteWebDriver(DesiredCapabilities.Firefox()); IWebDriver wd = new SimpleBrowser.WebDriver.SimpleBrowserDriver(); try { wd.Navigate().GoToUrl("https://www.google.com/"); wd.FindElement(By.Id("gbqfq")).Click(); wd.FindElement(By.Id("gbqfq")).Clear(); wd.FindElement(By.Id("gbqfq")).SendKeys("fiserv"); wd.FindElement(By.Id("gbqfb")).Click(); if (!wd.FindElement(By.TagName("html")).Text.Contains("Fiserv: Financial Services Technology, Mobile Banking ...")) { Console.Error.WriteLine("verifyTextPresent failed"); } } finally { wd.Quit(); }