Using Selenium, with an earlier combo of the webdriver (2.28.0) and Firefox (pre-19), the following code worked.
driver.get("http://www.haemonetics.com/en");
driver.findElement(By.linkText("LOGIN")).click();
driver.findElement(By.linkText("Haemonetics")).click();
With webdriver 2.31.0 and Firefox 19.0.2 the code does not work and I receive a NoSuchElementException for the second findElement.
I tried using xpath which doesn't work for Firefox but does work for Chrome and IE, which are part of the same test suite.
Any thoughts or another way to accomplish the same thing? I would prefer to use the same code for the mentioned browsers.
Not sure if it was a typo on your part, but it should be "find_element" instead of "findelement", at least it's so in 2.31 to my knowledge.
Try
driver.find_element_by_link_text("LOGIN")
if that doesn't work, post your HTML code so we can possibly construct a working Xpath.
Related
how is it possible to easily obtain short form of XPATH through Inspector?
For example, if I try "Copy xpath" on web element I get pretty long response like this:
/html/body/div[6]/div[1]/div[1]/p[13]
Instead of this or similar:
//[#id='exeample_value']*
Since I need to cover a lot of these, do not want to loose time to shorten them manually. In older versions of Firefox I used plugins like Firebug and Firepath, but they seem not to be compatible with new FF versions (and FF Dev Edition).
The Firefox DevTools don't allow to copy relative XPaths yet (as of Firefox 58). Therefore I've filed bug 1410810 for it some time ago.
Here is a reproduction repo:
https://github.com/anatoliyarkhipov/nightwatch-firefox
It's a clear installation of nightwatch and webdriver-manager. The test opens http://example.com, clicks on the link and checks some content on the next page.
The problem is that if I run it in Firefox, it fails on the first step where we check that <body> is visible. If we change firefox to chrome in nightwatch.conf.js, then the test will pass.
I run it on Windows 10, Firefox 57.0 (64-bit).
What am I doing wrong?
You are missing path to the driver files in your config files
https://github.com/IvanNaumenko/test-project-nightwatch-cucumber
Hey!
This is nightwatch with cucumber. Download and write tests like in example here. You won't regret
Make sure you have the right version of geckodriver. Get the latest here: https://github.com/mozilla/geckodriver/releases
I'm getting a TypeError: elem.dispatchEvent is not a function using select2 in jquery using the wrapbootsrap pixel-admin theme.
It can be reproduced in firebug on the demo site via http://radiant-ocean-4606.herokuapp.com/forms-advanced.html
Firefox Version: 29.0.1
Firebug Version: 1.12.8
It's a similar error message to this question:
"element.dispatchEvent is not a function" js error caught in firebug of FF3.0
But the answer there doesn't help me as my site is all jquery (well as far as I know - I did somewhat accept the theme bundle as it came for the time being until I have time to really rip it apart and modify it in detail).
This was caused by changes to the browser, the solution was to stop using firebug. The features firebug offered are ubiquitous now!
In Safari 5.1.2 on OSX
Tech.li is completely broken.
Some people mentioned an extra div tag being the cause, but that still didn't fix the issue.
Any help would be greatly appreciated!
Pretty basic: fix your xhtml errors [Invalid] Markup Validation of tech.li - W3C Markup Validator (scroll down in the validation report to see line numbers and source code). And use Firebug with Firefox, or in Chrome or Safari or IE8, use the developer tools to find and fix the javascript errors.
I'm trying to buy something at Paypal-Sandbox with Selenium RC (Java), but it doesn't work.
I tried it with Selenium IDE (Firefox AddOn) and it did work. I changed the viewing and copied the JUnit 4 Code and it still doesn't work.
The problem is the part with the radio-button "payment_type_paypal". Somehow it doesnt work in RC (the radio-button is not checked). Do someone have similiar experiences and/or resolved the issue?
After loging in to developer.paypal.com and entering the homepage...
//linking homepage
selenium.click("legalTerms");
selenium.click("pay");
selenium.waitForPageToLoad("30000");
//leaving homepage and switching to paypal
selenium.click("payment_type_paypal"); // <===== point of error
selenium.type("login_email",username);
selenium.type("login_password",pw);
Thx :)
its me againg, Krzys. I know now the Problem. Its an issue with focussing the correct frame. I couldn't get it work with Selenium RC.
You can easily fix the issue in Selenium WebDriver with the command, before my "point of error":
driver.switchTo().defaultContent();
its me again. If you encounter problems with the Sandbox System of Paypal, you can overcome the "submit"-button issues using xpath.
driver.findElement(By.xpath("//div[#id='nav-menu']/form/ul/li/ul/li[6]/input")
Greetz
Krzys