Watin works in background - web

I started using WaTin as web automation tools. My target is let WaTin run their tasks, when success (such as complete sign-in) it will show the results in textbox and datagrid. My question is does WaTin can work in the background? (Not open IE every time).
Thank you.

You can hide the IE interface but it depends on the particular site you are working with. Most of the things can be done in the background but there are cases were you need to have the UI visible to calculate coordinates (like when you need to press a button inside a Flash movie) But to answer your specific question, yes Watin can work in the background. Take a look at the following method:
browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);
browser is the Watin object.

Related

Is there a way to take control of an open Edge or Chrome browser window using Excel VBA?

I'm attempting to use VBA to transfer data from an Excel sheet to a number of input boxes on a webpage. Due to a couple of considerations specific to this site it would be much, much easier if I could simply log in to the webpage manually then use Selenium (or whatever) to take control of the browser window and execute the data entry tasks. My impression is that this was quite doable with Internet Explorer, but that's been phased out, and it looks like there's not a very robust method for doing this with Google Chrome. Is there a way to do this with Edge?
I managed to get half of the data entered using the AppActivate statement and a series of SendKeys commands - this was with Chrome - but that approach won't work for the rest of it, since AppActivate doesn't seem to really commandeer the browser window in a way that allows Selenium to click buttons etc.
Yes you can use control browser with selenium Basic. You can follow instruction on how to get it working with vba here. https://simpleexcelvba.com/google-chrome-automation-with-selenium-basic/#:~:text=Selenium%20Basic%20is%20a%20Selenium,by%20double%2Dclicking%20on%20it.

Sahi: Cannot execute scripts recorded in a browser in multiple browsers

Our web application is designed such that the text transform is picked from CSS.
There are multiple links on a webpage; hence i will take example of a Next link.
When i hover the mouse over Next link in FF, it shows the below code:
_click(_link("Next"));
Similarly when i hover the mouse over the same link in Chrome, it shows the below code:
_click(_link("NEXT"));
When the script is recorded in FF and executed in chrome, it fails at the location because "Next" link is unavailable. This is one example of a link and there are multiple links and multiple pages. For this scenario, do i need to verify the text for each link or is there a universal way i.e. toLowercase method that can help me.
Thanks.
As Kshitij pointed out, you can get this working by using a regular expression as your accessor... but you might also check the Alternatives pulldown in the Controller. Perhaps there's an alternative accessor that is better suited for both browsers.
I think, the question should be how can Sahi identify the element with text by ignoring the case-sensitivity.
Any tool can only record the attributes which is available on the browser at that time.
You can use the following code to achieve the functionality:
_click(_link("/Next/i"));

vb.net How to prevent modeless form from being blocked by modal tool dialog in ArcMap?

I have a vb.net project running as a toolbar extension in ArcMap. Each one of my tools opens a modal dialog using the .ShowDialog() method. My client wants to be able to open a PDF document from the tools that will serve as the help documentation tool rather than a traditional method like HTMLHelp or Windows Help Viewer.
So, I've imported the Interop.AcroPDFLib.dll and set up a form with an AxAcroPDF (veiwer) object on it. Whenever the user clicks the help button on any of the tool dialogs, the help form opens using .Show() and goes to the associated page in the document using the .setCurrentPage method. Everything works great up to this point.
However, as you can imagine, because the tool dialog is modal, it blocks the user from being able to interact with the PDF form. So, what I need is a technique to prevent this block so that the user will be able to scroll pages, click links within the PDF, etc. while the tool dialog is open. I.e., I need a solution that will mimic using the traditional HTMLHelp veiwer.
I've tried opening the PDF form in a new thread, but that causes ArcMap to crash at Application.Run(New PDFForm). Maybe this is because I have very little experience with multithreading, or maybe because ArcMap does not support multithreading. Not sure.
Anyway, any suggestions to get me started would be greatly appreaciated.

Recommendation for a multi-instance jquery dialog/overlay

Ok. had enough of trying out lightboxes, overlays and dialog boxes plugins. The problem is that very few of them support nested (multiple) dialog open at the same time - a typical requirement in my opinion.
I'm looking for a recommendation for a simple plugin that:
supports callsbacks for the usual onShow/onLoad... events
supports nested instances i.e. the user open a dialog, clicks a button on it, another dialog opens up while keeping the first one open in the background. In other words, it should support the closure of each instance programatically
is NOT the jquery ui dialog plugin
This came about after the big disappointment with SimpleModal's inability to support multiple modal boxes open simultaneously!!!! #EricM, why would you do that to me? why???? ;)
I have narrowed it down to jqModal and the jquery tools overlay. The usage of the latter is weird. Maybe i'm tired but i just don't get it.
So before i dive into jqModal, does anyone have any recommendation based on personal experience that will achieve what I'm trying to do?
thanks

Enumerate browser tabs from external application

A bit of an odd (challenging?) question. Is it possible to programmatically access the tabs of an open browser from a external application? I realize that's a vague question, but hear me out:
What I'm trying to create is a "Gmail Chat Notifier" application that flashes a notification icon in the Windows system tray when an unanswered chat message exists. Right now, as far as I can tell, the only built-in Gmail chat notifications are:
Enable sounds (which I don't prefer)
Watch the window/tab/page title for the alternating flashing "Gmail" / "Blah says..." message.
The problem with #2 is: When the browser window is minimized, and when the Gmail tab isn't the active tab in the browser, the window title doesn't change and I don't notice new chat messages.
So I'd like to create an application that watches the tab titles for me. (All of the tab titles, not just the window title, which is only the active tab title.) I created a proof-of-concept C# application to detect unanswered chat messages by enumerating the active Windows processes and watching for the flashing "Blah says..." in the window title:
Process[] procs = Process.GetProcesses();
IntPtr hWnd;
foreach (Process proc in procs)
if ((hWnd = proc.MainWindowHandle) != IntPtr.Zero)
if (proc.MainWindowTitle.IndexOf(" says… ") >= 0)
...
But the obvious problem with this is that it won't work when the Gmail tab isn't the active/focused tab (since it only looks at window titles). So I need something that can dig deeper and look at the tab titles.
I'm open to anything. What I had been thinking might work is finding a way to enumerate the browser's tabs somehow (MDI child windows? * fingers crossed *), but maybe that's not even close to possible :) I'm also open to other solutions too if there's a way to do this with, say, Firefox plugins or something (but it'd be nice to integrate with the Windows system tray, and not just exist in the browser sandbox).
Can anyone help get me started? Thanks much in advance.
It's not possible in general. Browser tabs need not be MDI child windows (in fact, they almost certainly aren't). You do not know the window tree of an arbitrary browser, so you can't parse that and figure out the tabs (and even if you knew it for a specific browser, it's definitely an implementation detail that is likely to change even between minor releases). In fact, you do not know if the browser is even using separate Win32 window handles for tabs, as it may just have one handle for its main window, and draw everything inside by itself (e.g. Qt and WPF applications do that, and I believe that Opera in particular does that, and probably so does Safari).
Any solution to this will have to be browser-specific. You can probably write corresponding plugins for IE and Firefox to communicate that info to your application (though Firefox plugins are sandboxed, so I'm not sure if they are even able to do IPC). I don't see any options for Opera, Safari or Chrome.

Resources