AutomationGuy
Member
- Joined
- Feb 17, 2010
- Messages
- 5
- Programming Experience
- 5-10
Hi all
I'm trying to do some basic browser automation with one of our web applications, just to help with some system monitoring.
The task is fairly simple, open a page, complete two fields, click a button and check some page content, and for the most part I've done what I need to do, however I've run into a problem...
... the code works, and does all the interactions - the problem is that when it click the search button at the end, the web-page is giving me an error saying that I've not entered a value into one of the text fields (even though I have, and I can see the value in the text box).
I think the problem is that the web page fires some javascript on the back of the "keyUp" or "keyDown" event on the text box, and because of the way the browser automation works, that "keyUp" or "keyDown" event isn't actually being fired... hence why the browser seems to think that the text box is empty.
So the question from me is, does anyone know of a way to force those events to fire?
I was thinking something along the lines of this, but that doesn't work...
wb.Document.GetElementById("submit-search").InvokeMember("keyDown")
Perhaps I'm firing the wrong event, or firing it incorrectly... or both??
Thanks
I'm trying to do some basic browser automation with one of our web applications, just to help with some system monitoring.
The task is fairly simple, open a page, complete two fields, click a button and check some page content, and for the most part I've done what I need to do, however I've run into a problem...
VB.NET:
wb.Navigate(sPageUrl)
WaitForPageLoad() 'custom method to wait until the page has fully loaded
wb.Document.GetElementById("houseNo").SetAttribute("value", sHouseNo) ' enter text
wb.Document.GetElementById("postCode").SetAttribute("value", sPostCode) ' enter text
wb.Document.GetElementById("submit-search").InvokeMember("Click") ' click button
... the code works, and does all the interactions - the problem is that when it click the search button at the end, the web-page is giving me an error saying that I've not entered a value into one of the text fields (even though I have, and I can see the value in the text box).
I think the problem is that the web page fires some javascript on the back of the "keyUp" or "keyDown" event on the text box, and because of the way the browser automation works, that "keyUp" or "keyDown" event isn't actually being fired... hence why the browser seems to think that the text box is empty.
So the question from me is, does anyone know of a way to force those events to fire?
I was thinking something along the lines of this, but that doesn't work...
wb.Document.GetElementById("submit-search").InvokeMember("keyDown")
Perhaps I'm firing the wrong event, or firing it incorrectly... or both??
Thanks