Handle popup window globally in automation testing using ruby watir web driver - ruby

I am using watir web driver for web automation testing. I have to handle the popup window dynamically which is without title. This popup will display at any case. so i need to handle globally. Can anyone help me to solve this issue.

If something like that shows up intermittently, I would (assuming you're using cucumber) make a page object for the pop up, and use it in an AfterStep hook.
Something like this
AfterStep do
pop_up = PopUpPageObject.new(self)
pop_up.close if pop_up.present
end

Related

UiPath cannot click Chrome inspect feature "accessibility checker"

I have to automate on button "Accessibility Checker" which will come after inspecting the web page as shown in the picture. Please suggest me how to automate this as of now I am using UiPath, but that is not working (not able to select a correct Selector).
As far as I know chrome is a bit tricky since it has a lot more background updates than other browsers. So use something like IE if you can. Other than that, you can use anchor base activity with image activities. I get accurate results with that solution on cases where I am not able to use clicks.

Scraping an Angular website with selenium and C# returns the angular script, not the rendered web page

This seems to be by design as far as I can tell. Selenium can see the initially loaded HTML, but not the HTML after it's been massaged. I've tried IE, Chrome and PhantomJS and they all show the same behavior. So does the built-in Chrome debugger, until you inspect an element on the page, you can't query any of the rendered HTML.
I'm looking for any suggestions about how to scrape the web page. The only option I see right now is finding the chrome process, triggering the inspector, clicking inside, then running the Javascript. Needless to say, this sounds fragile.
I also haven't been able to find anything on capturing the Ajax calls from selenium so I can make them and capture the JSON. When tried copy / paste from the chrome network tab into selenium I got a missing application block message.
Does anyone have any other advice?
Since I can replicate the issue in the chrome debugger, I don't see posting code as useful. It looks like a design decision.
Ralph
Sadly, I wasn't able to do things in a straightforward way. Instead, I used Selenium to do the login and navigate to the page, then use windows API calls to click inside the window send ^a^c to copy the data and an absolute location to click on the button to go to the next page.
The site is set up so that ^a^c copies the raw data for this site. I don't know if that's standard for Angular or not.
Fragile, but it works.

WKWebView strange behaviour when opening target="_blank" links on OS X

I am developing an OS X wrapper around a popular web application, using WKWebView. However, when I try to open a link from the app, I get this strange behaviour:
tap on the link (the link has target="_blank")
webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures: is called
trying to extract the url from the navigationAction parameter in the delegate method above I get an empty URL
webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler: method is called with the following message parameter: "Grrr! A popup blocker may be preventing the application from opening the page. If you have a popup blocker, try disabling it to open the window."
Has anyone experienced anything similar? My idea is that they are doing something fancy with their javascript to track clicks and this is blocking the normal link behaviour.

how to crawl web page with ajax elements

I want to crawl some web pages, like the following
http://www.youtube.com/user/koglin66/feed?filter=2
but there is a 'load more' button, it is related to an ajax request
http://www.youtube.com/channel_ajax?action_load_more_feed_items=1&activity_view=1&paging=1352148528&channel_id=UCCw8aVnsIeu9S6OPQyaQ14g
I want to crawl the whole page.
Manually, I have click on the button repeatedly until there is no more to load,
by automation, how can I crawl the whole page? thanks!
Yes, you can use Selenium IDE, or use other program/library with browser core to do click action. Like webkit, activex of IE.
And you can try FMiner http://www.fminer.com/, it can record and play human actions on browser to scrape data, but it's not free.
I recently faced same problem with other website I wanted to scrap. I use Java and after some research on the web I used Selenium IDE for firefox in which u can write Java Junit test cases which will automatically open the webpage and click buttons, fill up forms, etc.
It also supports C#,Python,Ruby,etc
I used it to click on Load More button and when the page was loaded completely after all clicks I saved it Manually.
You can download Selenium from their website and I found this youtube video useful too http://www.youtube.com/watch?v=twdDfDOrHC4

Detecting state changes in Internet Explorer

I'm trying to automate some tests on Internet Explorer. How can I find out if the state of the webpage being shown is changed? Is there any way to know when the page finished loading, if it changes, if it is scrolled, etc.?
I want to know how I can get this state information from another running process.
Selenium allows you to test for completion of a page load and many other events within Internet Explorer and many other web browsers. It's a tool for autmoated testing of web pages.
It allows you to write tests that perform actions and test the state of pages.
You could either look at the source for selenium and see what it's doing or just use it to do your testing.
I'm not sure how a web page would scroll by iteself in an automated test, but you could detect if the scroll Has happened by storing the window.scrollX value when the page is loaded and testing to see if the value has changed.
Basically, if you want to detect things like window scrolling in Internet explorer, you probably need your own piece of code running in the browser, like a BHO (Browser Helper Object).
There might be a way to do Event Sinking. Have a look here: http://asp.dotnetheaven.com/howto/doc/Interop/TestClient_2.aspx

Resources