How find elements inside iframe - Selenium IDE - selenium-ide

I am use Selenium IDE for simulate an user interaction with the application. I am using New Relic and the application is wrapped inside an iframe. How can to find elements inside the iframe?
For example:
<iframe allowfullscreen="" class="AAKXAC-wnd-ThirdPartyComponent" src="https://4b1a7ce2-7a5d-418d-a75e-05611871ae7c-1.g0.nr-ext.net/#eyJjc3MiOlsiaHR0cHM6Ly9kMXpvYmJoOGt5dHJ0di5jbG91ZGZyb250Lm5ldC9wbGF0Zm9ybS8zcmQtYXBwLTU5N2RhZDBkLmNzcyJdLCJqcyI6WyJodHRwczovL2Qxem9iYmg4a3l0cnR2LmNsb3VkZnJvbnQubmV0L3BsYXRmb3JtLzNyZC1hcHAtYzRkZmIyNjguanMiXX0%3D">
#document
<html>
<body>
<div id="root"></div>
</body>
</html>
</iframe>
When in Selenium IDE. I define a step:
verify element present css=.mainContainer
Its returns me an error because the element with the class 'mainContainer' is inside in an iframe. How can find elements in iframe? I am use Selenium IDE in Chrome

Solution
Select the newly inserted row as shown below:
While the newly insert row is selected, enter ‘select frame‘ command into the Command field and index=0 (which locates the first out of the available frames on the page) as shown below:
Note: We have to increase the index value say 1,2,3,4 etc. if the required frame is not identified.
Click on ‘Run current test’ option and observe that the test got executed and the ‘Hotels’ links inside the frame got clicked as shown below:

Related

How do you insert a python string into a link tag html

I’m trying to make a scraper project that takes links and displays on a html page but you can’t use html tags in pyscript tag.
Is there any way to do it
What I find with printing the link is that it gives the literal string of the link and not a clickable link
This isn’t the actual code but acts as an an example of the problem
<py-script>
Var= ‘Link’
</py-script>
<body>
<a href=link>Link</a>
</body>
You have created a clickable anchor tag. Move your mouse over the text and click it.
The problem is that the pyscript.css file is overwriting the attributes of some HTML tags changing how they appear. Remove pyscript.css from your program and notice the difference.
You could add your own CSS and make the Anchor Element appear how you want. To write serious PyScript programs you will need to learn about the browser DOM, CSS, etc.

ZK framework - no content in include

We have a tabbox whose tabpanels use include to include content:
<tabpanels height="100%">
<tabpanel>
<include src="#load(vm.myTabUrl)" />
</tabpanel>
...
</tabpanels>
Once in a while in production, the content of the include is not displayed. This behavior seems to be random and we don't know how to replicate it.
When it happens, the generated html contains a <div> for the include which only contains another empty <div> with class z-tmp:
ZK doesn't show any errors while rendering and neither does the javascript console. Also there are no failed http (zkau) requests. Any ideas?
ZK Client Engine is responsible for conversion of ZUL to HTML at client side.
ZK has a huge in-built component support compared to HTML. But the things that are displayed on Client side will be HTML itself.
We design a page in ZUL and it is converted into HTML in action. ZUL Components are larger than HTML components in number but in the end we get HTML components only with some changes in their structure.
How the ZUL page reconstructed to HTML page ?
ZUL page are converted to Div, input, anchor mostly.
ex: Groupbox
(ZUL) --> Multiple Div (HTML)
The ID of the DOM components are dynamically generated after conversion like z_p5,z_g3 and the ID
i.e given in ZUL page can be added at AID of the Component.
The DOM component can be allowed to have multiple styles separated
by spaces.
The Widget name is added to the component style as z-widget along
with our regular styles mentioned in ZUL page. The ZK Component name is added as z-widget in the style attribute of generated HTML DOM Component. As you have already seen that z-include is added in the style attribute of Div element in the above screenshot after generation
of page.
Coming to the Actual problem,
Open the AfterCompose method of the ViewModel of this page.
Assign myTabUrl directly with another ZUL page path and Notify it with
postNotifyChange method from below.
BindUtils.postNotifyChange(null, null, ClassName.this, "myTabUrl");
May be Variable is not properly assigned or Notifying the variable may be missed which caused this problem. If possible post the ZUL and VM code here if problem still not resolved after this trial.

Why can't I see script injected using GWT ScriptInjector?

I'm trying out using GWT's ScriptInjector for the first time, and was wondering why I can't see the injected script as a tag anywhere in the page when I view page source. I'd expect it to show up in the page head.
I'm using a dead simple example, which works in that it displays the alert. I'm just wondering why I can't physically see it injected in the page. Also if I declare a JavaScript variable inside my script, it doesn't seem available on the global scope.
ScriptInjector.fromString("window.alert('testing');")
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
ScriptInjector works by injecting your js snippet into the top level window object and, by default, remove it just after it got evaluated (if you used fromString(); with fromUrl() the element is not removed by default). This is why you do not see it, but it actually executes.
If you want to keep the injected script element, just use setRemoveTag(false) on your builder FromString object, i.e.:
ScriptInjector.fromString("window.alert('testing');")
.setRemoveTag(false)
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
Please have a look at below sample.
I have modified the inner HTML of a div. The changes are visible in Firebug but if you view the source it will be not there.
EntryPointClass:
ScriptInjector.fromString("document.getElementById('mydiv').innerHTML='hi';")
.setWindow(ScriptInjector.TOP_WINDOW).inject();
HTML:
<html>
...
<body>
<div id='mydiv'></div>
</body>
...
</html>
Snapshot:
View Source:

facebook button showing only once when outputting it via while loop

I'm using Gallerific with history plugin. In the while loop where I print all the images I want to add a facebook share button for each image using the specific image-url given by the history-plugin.
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>
$images=mysql_query("SELECT filename FROM images etc.");
while ($row = mysql_fetch_array($images)) {
<li><a class='thumb' name='imagename' href='url-to-image' title='description' onclick='clickedThumbnail()'><img src='url-to-thumb' alt='".$row['comment']."'/></a>
<div class='caption'>
<a name=\"fb_share\" type=\"button_count\" share_url=\"http://url-to-image-made-by-the-history-plugin\">Share</a>
</div>
}
My problem is that it is only printing the facebook share button once. In the first while-loop. On the rest of the images it is printing the content of the <a>-tag ('Share') with the right attributes, but it is not clickable. I've tried without 'share' in the <a>-element but then I get nothing on the other images. But I always get the correct FB-button on the first image.
According to developers.facebook.com I only have to include the javascript once even though I'm using several Facebook buttons on one page.
I have also tried to put several facebook-buttons outside the while-loop and it works fine.
Also, when I type the direct url to the images given by the history plugin it works fine. So my conclusion is that is has to do with printing the facebook-buttons from a while-loop..?
I used this approach instead http://developers.facebook.com/docs/reference/javascript/FB.ui/
by changing some variables dynamically for each image. Works like a charm!
Thanks for the comments.
That plugin is deprecated. See: http://developers.facebook.com/docs/share/
You will want to use the share functionality that is part of the like button. See: http://developers.facebook.com/docs/reference/plugins/like/

multiple fancybox on same page

I'm using fancybox with ajax request to open multilpe fancybox instances on same page:
This is html code:
User
and this is Javascript i've used:
<script type="text/javascript">
$(document).ready(function()
{
$(".comment_button_fancy").click(function(){
var element = $(this);
var Ide = element.attr("id");
$("#"+Ide).fancybox();
return false;});});
</script>
Everything could be ok, just 1 problem... first time i load the page, i need to click 2 times over "User" to open fancybox...
If i open fancybox and then i close it, the second time i can click just 1 time...
why?
Thanks
The first click registers the event to the DOM, and the second (and subsequent ones) show the Fancybox.
If using multiple Fancyboxes, you should avoid using ID's like you have there and change it to classes. Not sure why you've got all that code to launch the fancybox, when this should work:
$(".comment_button_fancy").fancybox();
This will Fancybox all elements with the class "comment_button_fancy" and should fix your two-clicks issue. You don't need to put a 'click' event handler around the Fancybox code, as it inherently has that event attached to it.