Hello everyone. I used to use WatiN for my Web Automation project. But, IE looked slow to me. I tried to use WatiN with FF projects, but it seems WatiN with Firefox is not as powerful as WatiN with IE.
Before I though this, I researched how to use WatiN in Firefox 3.5. Because WatiN comes with jssh for FF 2.x and FF 3.x. When I use WatiN with Jssh FF 3.x, FF crashes. So, I found a topic in this site, it says SWAT (Simple Web Automation Toolkit) has a newer version of jssh and compatible with 3.5.
I downloaded SWAT and installed that extension to FF. It really worked! But it seems, WatiN can't open multiple FF pages at once and can't open FF page when a FF page is already open. This is very annoying.
So, I looked to SWAT again. There are rarely C# document for SWAT but, SWAT's scripting language is already almost the same as C#'s. Everything looks good in SWAT (still is not as good as WatiN with IE, but for FF it's better than WatiN).
I like console apps more than GUI's if I will not share my project. So, I created a console application. Wrote codes etc... I ran my project, but it seems SWAT sends a debug output or console output/print or whatever.
for example: When I use this code:
var ff = new WebBrowser(BrowserType.FireFox);`
I see this text on my console screen:
(09.10.2009 09:57:09, 0) - Firefox browser initialized...
And there are more than this.
The code I written:
var ff = new WebBrowser(BrowserType.FireFox);
ff.OpenBrowser();
ff.NavigateBrowser("www.google.com.tr");
ff.SetElementAttribute(IdentifierType.Name,
"btnG","value","Search with Google!");
Console output:
(09.10.2009 10:04:56, 0) - Firefox browser initialized...
(09.10.2009 10:04:56, 0) - Starting firefox process..
(09.10.2009 10:04:56, 0) - Found firefox window, attempting to establish connect
ion..
(09.10.2009 10:04:58, 0) - Connected, attempting to attach to browser
(09.10.2009 10:04:58, 0) - Attempting to attach to window about:config
(09.10.2009 10:04:58, 0) - Send: indexCount = 0;window = null;i = 0;for(i = 0;i
< getWindows().length;i++){var windowTitle = getWindows()[i].document.title.toLo
werCase(); if(windowTitle.indexOf('about:config') > -1){if(indexCount ==0){windo
w = getWindows()[i];break;}else indexCount++;}}
(09.10.2009 10:04:58, 0) - Received: Welcome to the Mozilla JavaScript Shell!
(09.10.2009 10:04:58, 0) - Send: window
(09.10.2009 10:04:58, 0) - Received: [object ChromeWindow]
(09.10.2009 10:04:58, 0) - Send: var browser = window.getBrowser();print(window.
document.title);
(09.10.2009 10:04:58, 0) - Received: [object ChromeWindow]
(09.10.2009 10:04:58, 0) - Send: var browser = window.getBrowser();print(window.
document.title);
(09.10.2009 10:04:58, 0) - Received: about:config - Mozilla Firefox
(09.10.2009 10:04:58, 0) - Send: browser.loadURI("www.google.com.tr");print('OK'
);
(09.10.2009 10:04:58, 0) - Received: about:config - Mozilla Firefox
(09.10.2009 10:04:58, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:04:58, 0) - Received: OK
(09.10.2009 10:04:58, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:04:58, 0) - Received: 3
(09.10.2009 10:04:59, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:04:59, 0) - Received: 5
(09.10.2009 10:04:59, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:04:59, 0) - Received: 5
(09.10.2009 10:04:59, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:04:59, 0) - Received: 5
(09.10.2009 10:05:00, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:05:00, 0) - Received: 0
(09.10.2009 10:05:00, 0) - Send: print(window.document.title)
(09.10.2009 10:05:00, 0) - Received: Google - Mozilla Firefox
(09.10.2009 10:05:00, 0) - Send: print(browser.currentURI.spec)
(09.10.2009 10:05:00, 0) - Received: http://www.google.com.tr/
(09.10.2009 10:05:00, 0) - Send: var doc = browser.contentDocument;print('OK')
(09.10.2009 10:05:00, 0) - Received: OK
(09.10.2009 10:05:00, 0) - Send: browser.webProgress.busyFlags
(09.10.2009 10:05:01, 0) - Received: 0
(09.10.2009 10:05:01, 0) - Send: print(window.document.title)
(09.10.2009 10:05:01, 0) - Received: Google - Mozilla Firefox
(09.10.2009 10:05:01, 0) - Send: print(browser.currentURI.spec)
(09.10.2009 10:05:01, 0) - Received: http://www.google.com.tr/
(09.10.2009 10:05:01, 0) - Send: var doc = browser.contentDocument;print('OK')
(09.10.2009 10:05:01, 0) - Received: OK
(09.10.2009 10:05:01, 0) - Send: var elem = null;elem = doc.getElementsByName('b
tnG')[0];if(elem == null){for(i =0;i < doc.getElementsByTagName('iframe').length
;i++){ if(doc.getElementsByTagName('iframe')[i].contentDocument.getElementsByNam
e('btnG')[0]!=null){elem = doc.getElementsByTagName('iframe')[i].contentDocument
.getElementsByName('btnG')[0]; break;}}}if(elem == null){for(i =0;i < doc.getEle
mentsByTagName('frame').length;i++){ if(doc.getElementsByTagName('frame')[i].con
tentDocument.getElementsByName('btnG')[0]!=null){elem = doc.getElementsByTagName
('frame')[i].contentDocument.getElementsByName('btnG')[0]; break;}}}var origColo
r = '';if(elem != null){origColor = elem.style.backgroundColor;if(origColor == n
ull)origColor = '';elem.style.backgroundColor = 'yellow';}if(elem != null){ elem
.value = 'Search with Google!';print('OK');}else{ print('failed');}
(09.10.2009 10:05:02, 0) - Received: OK
(09.10.2009 10:05:02, 0) - Send: if(elem != null){elem.style.backgroundColor = o
rigColor;elem = null;};print('OK')
(09.10.2009 10:05:02, 0) - Received: OK
How to disable this output? I will print somethings to the console screen and they are important :).
Thanks...