Firebug won't let me select a script file - javascript

Firefox 13.0.1 with Firebug 1.9.2.
I load a page with Firebug activated. I select the Script tab. This page loaded multiple script files, and the script tab shows the first one on the list (which happens to be JQuery). So far, so good. I go to the menu with all the scripts, and I select the one I want to look at. It shows this script for about half a second, then switches back to JQuery.
This happens every time, but only on the page that I'm working on right now, and only with one particular script file. There aren't any error messages.
Anybody have any ideas?
Update: The problem appears tied to one line in the script file.
$(document).ready(function() {
// ...
// If I remove this, the problem goes away:
setInterval("foo()", 1000)
})

Related

Python selenium process exits after ActionChain onclick().perform()

Please I am not sure what I have done wrong. On the first page I have my code run the following:
next = self.driver.find_element_by_name("checkout_shipping")
actions = ActionChains(self.driver)
actions.move_to_element(next)
actions.click(next).perform()
after clicking next, I want my code to click deliver on the second page:
deliver = self.driver.find_element_by_name("final_shipping_option")
actions_check = ActionChains(self.driver)
actions_check.move_to_element(deliver)
actions_check.click(deliver).perform()
However the second page loads and does nothing. On terminal I get "Process finished with exit code 0" as though everything worked fine when it didn't.
Selenium is a Library that essentially acts as a user. So it loads pages on a browser and manually preforms a click.
I believe your script is finding the correct Element with name "final_shipping_option" but maybe it clicks it too fast for the browser since it's still loading in the Webpage.
Consider trying a time.sleep(x) or something like this:
Wait until page is loaded with Selenium WebDriver for Python
Another possibility is that the name of the element is incorrect, so you're clicking the wrong element? Try to click it via ID, or Class or even XPATH depending on if the page is very dynamic or not..

Why are the links not working on my webpage

I know this is sort of a please debug my code question, but I really don't know whats going on here.
I just added the content to this page and now none of the external or internal links will work (eg you click on them and nothing happens). The Mega menu drop down works fine and I can click on links on it, but the links in the text dont work, and neither do any on the sidebars
Here is the page that is causing the problems
http://www.cookingisfun.ie/cookery-courses/course-details/101618/Guest-Chef-Diana-Kennedy-at-Kerrygold-Ballymaloe-Litfest
here is a similar page that has no issue.
http://www.cookingisfun.ie/cookery-courses/course-details/101364/Guest-Chef-Lilly-Higgins
I can click the Back to CourseList button which I Can't on the first.
This is not just a problem with my machine, I have tried from another machine and an Iphone with same result.
I can't see any javascript errors but I assume it is something to do with the plugin that marks the links as external though that plugin works elsewhere on my site.
Any suggestions?
I guess you have some errors in your HTML code (wrong nesting of tags or something or you did not close a tag right). If I want to inspect the "Back to course button" with Firefox I get the following
It seems that the #content-blocks div is empty. Also the source code view of your page underlines me some tags red:
Normally this means that there are some HTML errors. Here the output of the HTML validator: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.cookingisfun.ie%2Fcookery-courses%2Fcourse-details%2F101618%2FGuest-Chef-Diana-Kennedy-at-Kerrygold-Ballymaloe-Litfest&charset=%28detect+automatically%29&doctype=Inline&group=0

Instantclick running functions more than once

I'm using http://instantclick.io which is a jQuery plugin for pjax, however I'm getting some strange problems with my scripts. I've moved bits around so that scripts which did run on $(document).ready(function(){ now run on InstantClick.on('change', function(){ but I still get random problems when I browse through my website.
I was starting to get a feeling that the code is being run more than once, for example when I click on a button, the code it should run was happening more than once. So I stuck this piece of code in my js file just to see what was going on:
$(document).click(function(){
console.log('click');
});
So whenever, I click on anything in the page, I'll get a console log. On initial load of a page, I get the console log once per click. Then when I navigate to a different page, I get two console logs per click, then three logs on the third page I visit etc. So it seems that the InstantClick is caching the js file and running the scripts every time a page is loaded.
I tried putting the data-no-instant attribute on the script tag where the js file is included, but this breaks my code completely.
Hope someone can help!

jQuery works in old DOM after load

I have a page where I some jQuery code for. After it has finished it goes to the next page.
I use this to go to the next page:
$("body").load(//url,function(){
//do your work
});
The pages loads correctly into the old page. With chrome I can see the new DOM.
The function is exactly the same for both pages
$('button').each(function() {
//start working
}
Only at the second or even third page it keeps working in the old DOM.
The first and second page are almost exactly the samen just other data they both exists from tables.
As an example I have a table in every page with a random number of rows but I only need the rows where there is a button in, there are no other buttons on the page so I for each button.
When i execute the code everything on the first page goes like it should but at the second page it uses the data from the first page again, so not the new data I loaded.
If I take out the load and paste the code in console in chrome then there are no problems and everything works like it should. This is no problem if there are only 2 or three pages but if the page count gets bigger it will be a problem..

Layout breaks while page loading

I am using the a slider to display some WordPress posts. When I open the page, it hangs for some seconds (time varies) during that time, the layout breaks (for example all posts in slider become visible instead of first post), but as soon the page loads every thing gets back to normal.
I think this is because the jQuery code loads late. Is there anything I can do about that?
I'm currenly using this:
jQuery(document).ready(function() {
jQuery("#foo1").carouFredSel();
});
Also how can I check with the Firebug that what is causing this? (which resource is taking time to load), because it happens so quickly that I don't get time to see on Firebug.
you can hide it and make its display:none . till it loads then show it
<script>
jQuery(document).ready(function() {
jQuery("#foo1").carouFredSel();
jQuery("#foo1").show();
});
</script>
<div id="foo1" style="display:none"></div>
Firebug has a net panel that will allow you to view requests/responses made and received by the browser.
I'm assuming that it is most likely not jQuery. After you visit the site a few times it should be in your cache.

Categories