I have the following test in nightwatch:
browser.click('test')
The browser.click function works in chrome but not safari. Does anyone know why it doesn't work in safari?
I have experience this as well, but in your case my best guess is that you're not passing in a correct element, like a class. Example:
browser.click('.test')
What is the 'test' that you're trying to click?
I was having the same problem and apparently the element that I was trying to click on was not in the viewport yet.
I added browser.maximizeWindow() before triggering the click event.
browser.maximizeWindow();
I also included waitForElementVisible('.test',1000) before calling click().
I have had similar issues, a solution for me was to click using Xpath. You can uses Xpath text():
browser.useXpath()
.click('XpathToElement')
also i would inject JS to the browser and try to force a click.
browser.execute(function(){
document.getElementById("nodeId").click();
},[])
However be aware that this does not always solve the issue.
Related
Got stuck in capybara coding. appreciate any help on this.
I need to mouseover on source element to click on the target element link.
Not finding a way to get it. need to use this in chrome browser only.
Tried the code below
source=ses.find('#source-link')
ses.driver.action.move_to(source).perform
ses.find('#child-link').click
If what you're trying to do is hover over #source-link and then click `#child-link' it should just be
sess.find('#source-link').hover
sess.find('#child-link').click
If that doesn't work for you then we need to know exactly what events are triggering the behavior you expect.
I'm automating tests using Selenium on Firefox, and everything was working ok until I needed to check checkboxes that are not visible due to a footer that is fixed to the bottom of the page.
It's a long list of disclaimers that are necessary to be checked in order to continue.
The first two are below this footer, the rest forces a scroll down, and are checked correctly.
My question is:
1) Is there a way to check the first two even thought they are below the footer?
2) Is there a way to make Selenium scroll down using a command?
3) Is there a way to make Selenium to open a new Firefox window maximized? (I believe that if this is possible, all checkboxes will be visible on load)
Thank you!
PS: This is my second post, if I'm missing some information please let me know and I'll edit it.
EDIT:
Firefox version: 23.0.1
Webdriver version: 2.35
Unfortunately, i have only configured my webdriver for Firefox (not on chrome at the moment)
You don't have to scroll the page as long as you are finding the Element with correct selectors (e.g. xpath, css etc.), so something like driver.findElement(By.xpath("xpath")); should remove the need to scroll the page. As for opening the page in full screen use the following
driver.manage().window().maximize();
If your web page needs to be scrolled down to interact with element, first you'll have to bring that element into view. Using Ruby, this can be achieved by following:
element.location_once_scrolled_into_view
and then interact with element.
You can use javascript executor to scroll the page. I've found that Selenium will click objects that are "visible" but hidden behind something else on the page.
JavascriptExecutor jsx = (JavascriptExecutor)driver;
jsx.executeScript("window.scrollBy(0,450)", "");
I use the capability:
capabilities.setCapability("elementScrollBehavior", 1); // 0- from Top,
// 1 - from bottom
When I start the driver, I set the capability.
I have a script which enters some data in the page and click save button.
Here I used HTML component id for save button.
selenium.click("StudentID:saveData");
I even provided proper wait condition and also tried with X path locator.
The test passes. It doesn't throw any error message but the button is not clicked and the data is not getting updated.
Please let me know what might be the issue .
I had a similar problem and used a CSS selector instead. CSS selectors are much faster than Xpath (and in my experience work better in general, though Xpath is necessary for certain things).
If you are using Firefox, install the Firebug add-on; right-clicking on an element on the page will give you the option to copy CSS path. I've found that I often have to make some changes to it to get it working properly but it allows you to get to very deeply nested elements quickly.
The W3C has a good page on CSS selectors here.
Can anyone recommend a good alternative to qTip, the jQuery tooltip plugin? I feel like it's slowing down my web app because its adding canvas elements and event listeners all over the place.
GitHub.com uses tipsy. I trust that they have chosen pretty carefully, so that's what I would go for.
The Bootstrap tooltips are "inspired" by Tipsy as well.
jQuery Simpletip.
Take a look at jQueryTOOLS Tooltip
Here are 49 alternatives.
http://www.smashingapps.com/2011/12/05/50-awesomely-useful-yet-free-jquery-tooltip-plugins.html
Yeah I had problems with qTip also.
I ended up making my own. This seems to be happening more often. I just can't find what I want and end up making what I need.
https://github.com/donnyv/next-msg
Plus it has themes
don't forget about the Jquery UI tooltip
And Tooltip Demo
I fount https://github.com/iamceege/tooltipster with almost all essential functions of qTip.
The qTip js file is 64kb while this is 17kb. Which was important in our project.
Is it possible through a plugin or setting or something to allow Firefox to recognize the live DOM source code?
Basically, firebug or other similar tools can recognize elements on the page which Firefox does not.
I understand with these extensions I have the ability to see such changes made by javascript, but Firefox does not seem to fully recognize them.
I'll try to clarify.
If I load a page and view source (ctrl-U), I see what the server sent to Firefox, and what Firefox ostensibly recognizes as the source code of the page. If in that source code, there is javascript which alters the DOM, and then I hit (ctrl-U) again, the code is not updated.
I am using a testing tool (iMacros firefox plugin) to automate functionality, but it does not recognize the updated DOM because Firefox does not. Firebug and similar tools can recognize these "live" updates. Does that help?
http://www.chapter31.com/2006/12/04/viewing-ajax-generated-source-code/
You can try using the web-developer extension with a view-generated-source option.
I'm still not sure I understand your question, but I think what you're getting at is the Web Developer extension for FireFox, specifically its "View Generated Source" feature.
That will let you see the altered DOM.
Firebug gives u this ability:
for instance check the HTML tab when running a jquery ticker and see the dynamic changes live in the DOM
Usually, when I have weird issues with either the console or the DOM inspector with firebug, I find restarting the browser and validating your code is the way forward.
That said, I'm not really following your question, the document that firebug shows is the same one in the firefox window...?
It looks like the problem is not that you want firefox to show the current DOM when you hit CTRL+U, but that you want some automated testing tool to be able to test your web pages.
Perhaps you should use a testing tool that is suited to the job of testing rich web applications, Selenium, for example, can do this.