VBA for MAC navigating browser with elaborate functions - macos

I have a Google Analytics Macro that works perfectly fine in Windows, but I need to use it in MAC.
I am having trouble with opening a browser and navigating in it. This is an example of code that I use and didn't find support in MAC:
Set HTMLDoc = oIExplorer.document
HTMLDoc.all.Email.Value = GAlogin ‘this is a string I got in another part of the code
HTMLDoc.all.passwd.Value = GApassword ‘this is a string I got in another part of the code
For Each objButton In HTMLDoc.getElementsByTagName("input")
If objButton.Type = "submit" Then
objButton.Click
Exit For
End If
Next objButton
I found ways to open and navigate browser, but none of them would support this kind of code. More specifically, none of them allowed the getElementsByTagName part nor going through the elements and clicking a button.
Does anyone know how I could navigate and use a browser in MAC that would support this functions?

Related

Selectors only work when webpage is opened in Internet Explorer

I created a login sequence and my selectors for the input email, password, click login and element exists are valid. But only when I have the Internet Explorer page open on the website I'm working with.
I did that sequence again, and I ran it, initially it worked but when I ran the hole project it broke again, I tried "repair" and "indicate", I tried to eliminate the title but nothing is working.
As far as I can see, you are using selector attribute:
"title=ACME System 1 - Dashboard"
Try using a wildcard: title='ACME System 1*', so it can work when you leave the dashboard.
This worked for me when I took those UiPath Academy courses.
In order to automate tasks within a browser with UiPath, the browser must be open. There is an activity called Open Browser that's included in the default activities for every project. You need to add this activity to the beginning of your sequence and pass in the appropriate parameters, (ie. URL, browser type) you can then pass the outputted browser variable to an attach browser sequence and execute your browser automation acivities within that.
Browser activity sceenshot
In addition, the selector that you have shared does not look like a stable selector. There may be other 'H1' elements on the screen that will cause your automation to fail. I would use the UI explorer to help you build a better, more stable selector.
Did you initially use IE to indicate screen elements and then changed the BrowserType property to use a different browser? Please share the sequence to suggest you a fix for your issue.
I would also suggest you to modify the selector to 'title='ACME System *'.
In order for selector to work the application needs to be open and the desired element needs to be available. So when you close the browser the selector disappears.
You may consider swithching to 'Modern Design Experience' and use 'Use Application/Browser' scope to make this more intuitive, and it will also automatically open the browser for you if it is closed.

Problem opening Office URI Scheme urls in Office.js on Mac/Safari

I'm developing a JavaScript addin for Office applications, e.g. Word, Excel and PowerPoint. At some point it should open a file that resides somewhere in SharePoint.
I want the url to open the correct Office application right away and for this purpose I'm using Office URI Schemes (see https://learn.microsoft.com/en-us/office/client-developer/office-uri-schemes?redirectedfrom=MSDN).
Depending on the logic in the app, I'm using two different techniques, which work perfectly when the addin is running in Word, Excel or PowerPoint on Windows.
Technique 1 (normal link)
Open Me!
Technique 2 (programmatic)
// Js pseudo code
button.onclick = () => {
window.location = 'ms-word:ofe|u|https://foo.sharepoint.com/path/to/file.docx'
}
As I mentioned, both these techniques works flawlessly on Windows. But when running the addin on e.g. Word Desktop on Mac, absolutely nothing happens. I've debugged the addin, by using "Inspect Element" to open up the console, but there's no errors or anything. It seems to me that the internal browser on Mac silently refuses to open the link.
However, if you paste the link into e.g. a word document, it will open the document if clicked.
Some thoughts:
is this related to the manifest.xml for the addin? (still works on windows without modifying the manifest)
do I need to enable something on Mac for this to work? (the Office URI Scheme page states these links should work on Office for Mac 2011)
Any input is greatly appreciated.
I found a workaround that works on Mac as well by using window.open(url).

WatiN downloading files

I am trying to use WatiN to do some screen scraping type of work. It runs on our site on a scheduler. I have no need to see the UI, I just need it to do the work. I can navigate the sites with no issue , but when trying to downlaod the files I have 2 problems.
Using IE 11 when it comes time to download , I get stuck on the open/save dialog that pops up. I have tried and tried and tried everything to have IE 11 auto download files, but to no avail. I edited the registry, and tried every option in the security tab, but no luck. I tried using SendKey.Sendwait("{TAB}"), to mimic what would need to be pressed , but I get "access denied" I think the "ui" is locked.
so I tried Firefox, firefox is easy to configure "automatic downlaods" .... but
FireFox wont even connect, I get: No connection could be made because the target machine actively refused it 127.0.0.1:9997 I installed the appropriate jjsh addon and install it globally for all users from the command line, but still no luck.
Any suggestions on how to disable that yellow bar that IE 11 puts at the bottom of the screen to annoy you , or what I might try with firefox? I believe configuring IE 8 to disable the yellow dialog bar is possible, but I am on a windows 8 machine , so I'm stuck with IE 11, or possibly 10.
You can keep trying to find a solution but that solution will probably break in a next release of IE (based on previous experience) to be able to finally solve and be future proof (if there's such a thing in development....) I would suggest to navigate to the page that has the link and get the HREF portion of it and once you have that link just do the download using other ways, like the following:
(this is just pure C#, not watin)
string downloadURL = "http://example.com/retrievePDF.jsp?id=XXXXX";
client.DownloadFile(downloadURL, #"C:\temp\" + fName + ".pdf");
you should replace the downloadURL with the value on the HREF of your download link and you will be able to find the file where you specify it.

UFT - Object Identification not working on Run Time

I have written a code for Web page. The process requires me to click on a weblink which opens up a new window, then perform some operations on the browser window. Then I close the new browser. This is repeated multiple times in the code. All the elements on all the browser windows are normally identifiable using the object spy. However, intermittently during run time when a new browser window opens up the elements on the page are not getting recognized (hence it throws errors). When i go into the debug mode and try using the object spy the maximum identification i can capture is Browser(<>).Page(<>). Nothing in the page is getting recognized.
Now if i close this browser and reopen it and check again, the elements on the page are getting captured by the object spy and i can continue with my script execution. Sometimes I have to close and reopen multiple times for it to work.
Is there any way to handle this scenario. check for object identifications on the run time maybe. Dunno if it this is any relevant but i am not making use of the OR in my project.
Thanks in advance.
This sounds like a bug in UFT and you should contact HP's support.
A workaround if you know where the problem is probable to appear is to add Browser("<name>").RefreshWebSupport. This is an undocumented feature of UFT that sometimes helps in cases like this.

Problem with Pop-up Windows using Selenium

I'm new to the testing world, so my question might seem a lil' bit too naive and stupid. At risk of looking/sounding stupid, my question is this:
I've been trying to test the contents in a pop-up window on my company's web app. I've figured out how to detect the pop-up window for now, but i can't get selenium to 'click' on the link inside of that pop-up window. there are multiple pop-ups in this web app so it's really difficult for a newbie like to create a test case.
I tried the click, clickAndWait, mouseDown and mouseKey as an option but it is still not working. can somebody guide me through this?
TIA,
Angela
When the popup appears you will need to move the context of the script over to the window.
You can do this by using the selectWindow | window_ID_from_the_link and then do the clicking.
If that doesn't work you may need to use the openWindow command to create the popup and then start testing against that.
Use getConfirmation/getassert/getprompt according to the type of the pop up you use .....By default they will be clicked with ok option by the server and you have to consume the message from the pop up for the other selenium commands to work correctly.............
The above suggestion is given from my experience in working with selenium RC used with perl..........
Perhaps you can try the FireFox Plugin. You can click through your application and record your steps. After recording the steps you can easily save it as some sort of file or unittest.
I'm not sure about the command you should use for the popups, maybe the firefox plugin will help in this manner (it will create your commands).
If you created the popup with a div tag, U can use following code to stop the selenium server until the popup opens.
int second = 0;
while(!selenium.IsElementPresent(mylink))
{
if(second >= 5)
break;
Thread.Sleep(1000);
second++;
}
After a popup opens, Now you can click on any link inside the popup.You have to use the below code.
selenium.click("id=popup_link"); (popup_link is the id of the link present on the popup)
Good Luck.
Not sure if this is what you are looking for, but if you want to click on something specific that Selenium is not able to handle - like browser pop-ups or other pop-ups, you can use Sikuli Script. Sikuli does an image comparison and clicks on the same - this is very powerful.
Here is the link: http://www.sikuli.org/

Resources