0

win 7 32 bit with selenium 2.39

same piece of javacode for selenium working fine and completes off the test script in latest version of chrome (v31) and IE 10, however not with firefox 26.

import org.openqa.selenium.TakesScreenshot;

selenium.click("name=submit");
selenium.waitForPageToLoad("60000"); 
assertTrue(selenium.isTextPresent("ENQUIRY ERROR"));
takeScreenshot("screenshot.png", "screenshot.png");
selenium.click("name=menu");// hangs here this back, suppose to click the back button
selenium.waitForPageToLoad("60000");
takeScreenshot("menu.png", "menuback");

pls assist anyone, it looks like genuine issue, not sure if firefox require a fix or the selenium team or is there any tweak can be done in meantime.

user2862501
  • 41
  • 1
  • 6

1 Answers1

0

First of all, did you verifued that the element you tried to click is present?

assert backButton .isDisplayed();

Regarding the clicking, here is number of different approaches.

Finding the WebElement by the name argument:

WebElement backButton = driver.findElement(By.name("menu"));
backButton .click();

Or to write them together ("should" be the same):

driver.findElement(By.name("menu")).click();

Or you can use keyboard enter:

driver.findElement(By.name("menu")).sendKeys(Keys.Return);

Or:

driver.findElement(By.name("menu")).sendKeys(Keys.Enter);
Johnny
  • 14,397
  • 15
  • 77
  • 118
  • tried all yet button not clicked, rather getting this in log: – user2862501 Dec 23 '13 at 17:27
  • "Could not convert screenshot to base64 - Error: Invalid base64 data: data" – user2862501 Dec 23 '13 at 17:28
  • fyi im running the job from my laptop connecting to test pc via teamviewer. test pc on 32 bit, my laptop on 64-bit pc. believe this is not an issue as chrome, ie able to run the test succesfully. – user2862501 Dec 23 '13 at 17:29
  • 1
    any expert able assist? or did any1 experience same issue? im still facing the issue, I tried on another website application with same domain name. fine with latest Internet explorer (version 11), chrome (version 31) but test stop for firefox version 26. Pls assist. – user2862501 Jan 04 '14 at 15:12
  • this looks like genuine issue, not sure if its firefox bug or selenium driver bug. i can't reveal the website to simulate the issue as the website yet to be release to public and require login. – user2862501 Jan 04 '14 at 15:13
  • the test script contain 44 screenshot, could it be due to any restriction/limitation by selenium firefox webdriver? – user2862501 Jan 04 '14 at 15:53
  • If i understand correctly the data you provided, the error "Could not convert screenshot to base64" relates to the screenshot mechanism thats initialized (probably) after the error while trying to click on button happens. Please tell me, doest the button found by driver.findElement(By.name("menu"))? is he displayed .isDisplayed()? do you got the button in some iframe? – Johnny Jan 06 '14 at 12:14
  • hi stas,i will check if the button is found when the page is displayed. regarding the iframe, IE and Chrome run the script perfectly fine. pls assist further, i can provide details – user2862501 Jan 07 '14 at 15:36
  • i guess the button not found by driver.findElement(By.name("menu")), isDisplayed() followed by system.out.print prints nothing. but the button is visible. pls assist – user2862501 Jan 07 '14 at 17:31
  • any real expert who can provide solution? anyone up for challenge? – user2862501 Jan 08 '14 at 16:46
  • I still didnt understand from your answer: 1. In what line exactly the failure happens- in the first screenshot? 2. If no- "i guess the button not found by driver.findElement(By.name("menu")), isDisplayed() followed by system.out.print prints nothing. but the button is visible" so, isDisplayed() on the button you need to click, returns true or false? – Johnny Jan 08 '14 at 17:09
  • the last captured screenshot frm the test result is the screenshot before this line -> selenium.click("name=menu");// hangs here this back, supposed to click the back button. during test run, i can the test proceed right up to the page with back button (name=menu), but fail to do click and test run abruptly. – user2862501 Jan 09 '14 at 14:39
  • it didnt print anything, so it's false. – user2862501 Jan 09 '14 at 14:43
  • reproduce the problem and selenium team acknowledge firefox sees the element in div as invisible. "FirefoxDriver thinks that element div#contents is not visible." not sure if it require fix from firefox or selenium team... – user2862501 Jan 12 '14 at 17:23
  • Can you please post the relevant DOM part? – Johnny Jan 15 '14 at 08:36
  • check the link inspection of the object via firebug http://imgur.com/VFHWhWs seems like firebug inspection on dom showing nothing. seleniium team still investigating. looks like its firefox webdriver bug or selenium driver bug. manually navigating on firefox browser, we can click on tht button. – user2862501 Jan 17 '14 at 10:33
  • is there any workaround or anything that i can ask the developer to do to make the element visible (problem only seems with firefox webdriver though) – user2862501 Jan 17 '14 at 10:38
  • any expert can suggest any temporary work around? i tried driver.navigate().back() and still the test run abruptly same like the earlier problem.. – user2862501 Jan 19 '14 at 09:56
  • Please find this bug description. Is that relevant to your situation? http://grokbase.com/t/gg/selenium-developer-activity/13ctrttav3/issue-6774-in-selenium-click-does-not-work-in-webdriver-2-39-firefox-26 – Johnny Jan 19 '14 at 10:14
  • could be..selenium still investigating my issue which seems genuine..but i hope some temp work around is there..wonder why back click n navigation too doesnt work.. – user2862501 Jan 22 '14 at 15:34
  • its not only with firefox 26, i tried few firefox version n same issue – user2862501 Jan 22 '14 at 15:35
  • any workaround? driver.get url seems failing, driver.get url works fine in IE n chrome though.. – user2862501 Feb 02 '14 at 06:32
  • Are you working behind Proxy? I investigated more about this issue... looks like this issue appear for other users as well. Please check those links: http://code.google.com/p/selenium/issues/detail?id=2560 and http://stackoverflow.com/questions/7347494/selenium-webdriver-geturl-does-not-open-the-url – Johnny Feb 02 '14 at 09:09
  • nope dont think so, other browser (IE and Chrome) running fine the script. hope selenium admit there's some serious bug interacting with firefox – user2862501 Feb 03 '14 at 15:17
  • Have you checked the two links in previous comment? – Johnny Feb 03 '14 at 16:01
  • yup did check, tried the proxy setting and yet facing the same issue,im actually getting error "Could not convert screenshot to base64 - Error: Invalid base64 data: data" , which i highlighted above in the thread. – user2862501 Feb 04 '14 at 03:59
  • anyone facing similar issues, i can lot of comments on users facing similar issues.. – user2862501 Feb 05 '14 at 04:50
  • if i comment out the takeScreenshot from the codes, the script running fine. some really serious fishy issue with takescreenshot with selenium with firefox integration. – user2862501 Feb 05 '14 at 16:45
  • how the takeScreenshot implemented? can you edit and add it in the question? – Johnny Feb 05 '14 at 22:31
  • If i understant correctly, TakesScreenshot library not have takeScreenshot method (in Java): http://grepcode.com/file/repo1.maven.org/maven2/org.seleniumhq.selenium/selenium-api/2.11.0/org/openqa/selenium/TakesScreenshot.java it's something you got implemented locally in your project. Please provide your implementation of the method. – Johnny Feb 09 '14 at 09:40
  • i've made my code more robust and it's perfectly fine in latest chrome version and IE. Only firefox the script hang, not performing button click. sure tht nothing wrong with my code. hope selenium release new version (2.40) asap. selenium aknowledge mentioning its firefox issue. hope solution will b there soon. any1 have any luck/workaround? – user2862501 Feb 23 '14 at 12:04
  • tried with new release selenium 2.40..getting this error "cannot find symbol.selenium = new WebDriverBackedSelenium". any idea y n any solution? – user2862501 Feb 26 '14 at 18:36
  • selenium webdriver code even with 2.40 jar not able to interact well with firefox. tried right up from ff23-27, button click FirefoxDriver thinks that element div#contents is not visible. alternative get url, back (), navigate command all are failing. my test juz stay still until the define timeout, then ends. any1 else facing similar issue? – user2862501 Mar 01 '14 at 15:50