AutoIt - Internet Explorer Navigate to another page (Pop Dialogue Box) - internet-explorer-8

I am using AutoIT within Internet Explorer to navigate from one web page to another
The code I am using is:
_IENavigate($oIE, "http://www.google.co.uk")
However the web page that it is coming from displays a JavaScript popup box. I would like to click the OK button to allow the Navigation to proceed
I have tried using the following code:
ControlClick("Windows Internet Explorer", "", "[CLASS:Button; TEXT:OK; Instance:1;]")
However this doesn't work due to the fact that when the dialogue box appears the AutoIT process seems to pause itself.
The title on the dialogue box is "Windows Internet Explorer" and there are two buttons. The button I would like to click has the text of "OK"
Has anyone else come across this before? If so how can I solve this problem?

_IENavigate by default waits until the page is fully loaded. The dialog box may prevent a page to be fully loaded. The correct solution would be to:
_IENavigate the page without waiting for the page to fully load
Wait until the dialog box appears and close it
Wait for the page to fully load
The parameters for _IENavigate are like this, and you need to set $f_wait to 0:
_IENavigate(ByRef $o_object, $s_url [, $f_wait = 1])
To wait for the dialog box to appear, you will probably simply repeatedly attempt to click it until the ControlClick function returns it did so successfully.

Related

Cannot complete download from popup when prompting location with saveAs

I've been working on a browser extension allowing users to generate epub files from any webpage.
To use the extension, a user has to click on a toolbar button which opens a popup. On the latter, after specifying a config, the user clicks on "Generate". Here is my issue though:
When I use the download API directly, and specify saveAs to false (i.e the user is NOT prompted where to save the file), then the download is completed as expected and the file saved in some location.
However, when I do set saveAs to true --- which is what I want in the final version --- then once the user has selected the location under which to save the file, the download fails. My intuition is that as soon as the file location window pops up, the popup looses focus and dies, which makes the download impossible to resume.
Is that the explanation? And is there a way to prevent such a problem? I do not find my use case to be much of a stretch, and do not get why popups associated with browser actions are not allowed to loose focus for file selection.
Another weird thing is that I'm pretty confident this problem only appeared recently in firefox, since when I started developing the extension, I had no issue.
My intuition is that as soon as the file location window pops up, the
popup looses focus and dies, which makes the download impossible to
resume.
That's right...
Browser Action Popup is page and once page is closed, async operations will lose their reference. It is best to pass async operations to the background script.
You can use
runtime.sendMessage()
to pass a message to the background script to run the download.
You can also use the async
runtime.getBackgroundPage() to run a function in the background script but the first option works
easier as you dont need to wait for the async response as in runtime.getBackgroundPage()

I need to save a CSV file using selenium and Ruby

I'm struggling with a feature.
I have a scenario where I click a hyperlink to download a CSV. I have the command to open the csv file sorted. Once that hyperlink is pressed, a pop up box shows up in Firefox and I need to select the Save File option then press OK.
I have no idea how to tell selenium to do this. I have a test code to confirm a new webpage has opened (below)
new_window=page.driver.browser.window_handles.last
page.within_window new_window do
current_url.should eql "https://...."
end
This approach doesn't work for the download pop up. I need to move to the pop up and press those two options.
Any help would be appreciated
You are missing one important thing: Once your hyperlink is pressed, Firefox directs the underlying operating system to launch a pop up. In other words, you are no longer dealing with Firefox, and therefore Selenium is completely blind to that modal window. Generally the solution is something like Sikuli, Robot, or some other framework.
Also, have a read through this: http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/

read/capture Windows pop-up message in vb6?

Problem: Need to read/capture the text of Windows pop-up messages that is generated by non-VB applications.
Situation:
I've a VB6 app, part of which requires processing an excel workbook. A non vb-6 pop-up window (as attached screen) "FILE CONVERSION IN PROGRESS" comes up, while opening an new version of excel-sheet from an old MS Excel app. And automatically it closes alos.
Requirement: I want to capture that pop-up occurance in the code. And then write a conditional statement code for the 'cancel' button click event of that non vb-6 pop-up.
Can anyone suggest something?
You can access other applications with the following APIs:
FindWindow() to locate the main window of what you're looking for
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
GetWindow() to navigate through the HWNDs of the application so you can get to the button
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx
GetWindowText() to access the text from a control (it cannot be an Edit control)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx
You'll want to use Spy++ (which can be downloaded) to see what the class name you're looking for when it comes up and to figure out the hierarchy to navigate properly.
You'll need to use the API Text Viewer to get the API declarations so you can use them in VB6 properly.

How to open mutiple tabs within a browser using Capybara?

I need to open multiple tabs within a single browser and i need switch over all the tabs.
Give me your suggestions. Thanks in advance.
I'm not so strong in capybara. so, i'm giving solution to switch over between tabs using selenium.
For a instance you clicks a button in a web page and it will open a new page.
The new page may open in a new tab in the same browser window or in a new browser window. That is not controlled by selenium. It will control by the browser which you using.
For a instance take firefox, goto tools->ptions-> tabs-> open new windows in a new tab instead check the option. For example, if you clicks a button it will opens a page only in the new tab of a same browser window. For a sake if you unchecked mean it will open a page in the new browser window. Likewise every browser has its own settings.
Try this code:
new Actions(driver)
.sendKeys(driver.findElement(By.tagName("html")), Keys.CONTROL)
.sendKeys(driver.findElement(By.tagName("html")), Keys.NUMPAD2)
.build().perform();
In above Keys.NUMPAD2 refers that you are gonna move to the second tab in the session.
You can move to Third, Fourth, etc... by giving NUMPAD3, NUMPAD4, etc... respectively. Here i am using windows OS, if you are in some other OS use their shortcuts.
I hope this will help you.
You can use this exact function in Ruby:
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)

Bypass " Do you want to view only the webpage content that was delivered securely?" dialog box

I would like to know how to bypass " Do you want to view only the webpage content that was delivered securely?" dialog box using VBscript ..
I am trying to open a webpage through IE in XP and after I login this dialog box appears.. and the contents of the pages are loaded.
I would like to bypass the dialog box.. I tried with Sleep and Send keys but didn't work because when the page is loading the script waits for sleep time and executes but actually that dialog box doesn't appear during that time (ie its all based on internet speed)
I would like to have a nice solution for this which works perfectly.
Thanks to all..
Your answer is here.
Here are the steps you need to take:
A) Open Internet Explorer and click on “Tools” and click “Internet
Options”.
B) Click on “Security” tab and click “Internet”.
Under “Select a zone to view or change security settings”.
C) Click “Custom level” under “Security level for this zone”.
D) Scroll down to the "Miscellaneous" section.
E) Select “Enable”
under “Display mixed content”.
F) Click “OK” and “Apply” to save
the settings.

Resources