using selenium-rc can i load a page, click a bookmarklet, and fill up the in-page loaded form? - selenium

Is there anyway by which I can automate the following steps
in Selenium-rc
open a page
click on bookmarklet in browser toolbar
fill up data in the form loaded into the page by said bookmarklet.
If the bookmarklet is not accessible as it is part of the browser/bookmark toolbar,
is there a way in which I can inject the javascript into the page and have it execute?

You are 99% there! You're right, you can't actually click the bookmarklet, but you can inject the same JavaScript in to the page. Simply use the getEval() command to evaluate the JavaScript.

Related

When writing end to end selenium tests, should I navigate to a page or just open the URL?

Say I need to submit a form on the 'Classes' page. I am testing the 'enroll into class' feature. Do I navigate to the page by clicking on the menu bar, or do I just directly open the URL of the page?
It depends on the scenario you need to test.
As an autoimation engineer you need to work according to the documentation.
If no scenario defined you can choose easiest way to do that.
Incase clicking on the menu bar is the part of your #Test, you have to access the base page and navigate to the desired page by invoking click() on the menu bar.
Else you can directly open the URL of the page.

Is it possible to scrape an Angular Website using Selenium-python?

I have been trying to scrape an Angular Website using Selenium. To my surprise it doesn't let you scrape the html rendered contents as it renders it dynamically using Javascript. I want to locate those tags for the purpose of scraping but I am unable to do so. What is the right way to scrape them? Here is some more context:
They say you can't do it using python.
Some also tried downloading all the html content and then read them. But again this isn't my use case.
But my use case is a lot different:
I want to login to my google account then it redirects me to an angular page where I click a button called reporting and from there I am redirected to a page from where I have to finally click download button to download the report.

Does Selenium/Protractor look for element in current loaded page?

Does Selenium/Protractor look for element in current loaded page, or look in the entire application when using the same Css Selector for same elements?
Eg:
Save Button on Customers Form class="save"
Save Button on Vendors Form class="save"
Protractor works by interacting with the browser (via selenium). Selenium uses browser drivers to interact with your page, and the browser only contains the code that it asked for (returned from the server, based on the type of request that was made).
So yes, it only looks for elements in the currently loaded page. It has no access to your entire application code.
Selenium looks for the element only on the loaded page. Not sure about Protractor though.

Colorbox display loading GIF between iframes

I'm using colorbox to load an external page in an iframe. As the page is loading you can see the loading GIF. All is good so far :)
Once the page is loaded, there is a form with a submit button. When I click the button, it loads a second page in to the same iframe. This all works fine, except it doesn't show the loading GIF while the second external page is loading.
Is there a way I can get this to show when I click the submit button, then once the page has loaded hide it again?
The reason for the difference in the behavior is this: the first load of the iframe is accomplished by ColorBox, which includes code to display the spinner. The second event is triggered by (I assume) your submit button so the ColorBox plugin isn't called.
This isn't strictly a ColorBox question, BTW, but I suggest you study the plug-in's code to see if you can reuse the technique that displays the spinner. Just a thought.
In any case, you'll likely need some javascript to handle the spinner display and event timings.

Is there a way to programmatically click links, input info into login forms, etc in Objective-C? (like Mechanize does)

Is there anything similar to Mechanize for Objective-C? I want to enter info into a search bar, select a link, and then extract some information from the webpage
You can either run JavaScript code in the context of your WebView or interact with its DOM yourself.
You can inject javascript into the page to do what you want with stringByEvaluatingJavaScriptFromString. For example to simulate a click, inject:
getElementById('the_button').click();