My code has run through two search engines quite well (Bing and DuckDuckGo) and now for the third “SwissCows”.
The code has to issue two searches (for “1” and for “2”) just to prove that everything is hooked up properly so that I can institute greater tests down the road. I reason that I should be able to crawl before I try to run, so to issue two searches before I try to issue hundreds of searches.
Code: Select all
For lngSearchTerm = 1 To lngcMaxTries
mydriver.FindElementById(strValue).Clear
mydriver.FindElementById(strValue).SendKeys (lngSearchTerm)
mydriver.SendKeys mydriver.Keys.Enter
Next lngSearchTerm
I operate on the web element's search box located by class, id, or name, by:-
(a) issuing a Selenium .Clear to clear the previous contents of the search box
(a) issuing a Selenium .Sendkeys to load the contents of the search box
(a) issuing a Selenium <Enter> to send the search box off to the search engine.
I pass through the loop just twice. On the first pass the search box is empty, is loaded with 1, and the search results come back to me. On the second pass, the “1” ought to be cleared, to disappear, before the “2” is loaded.
This works for Bing and DuckDuckGo, but in SwissCows the “1” is not cleared and I end up searching for “12” rather than “2”. If I looped to 3, I would end up searching for “123”, which is not at all what I want.
The Bing and DuckDuckGo cases suggest that my VBA program logic is correct, so this is a Selenium problem, right? And I should trot over to the Selenium forums?
Thanks
Chris