Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error i.e. org.openqa.selenium.ElementNotVisibleException: You may only interact with visible elements. #4346

Closed
NaukhaizAhmad opened this issue Jul 20, 2017 · 1 comment

Comments

@NaukhaizAhmad
Copy link

NaukhaizAhmad commented Jul 20, 2017

OS:
Windows 7 64-bit
Selenium Version:
Selenium web driver 3.4.0
Browser:
HtmlUnitDriver (htmlunit-driver-2.26.jar)

Expected Behavior -

Sample test script should work fine with the BrowserVersion argument.

Actual Behavior -

Sample script works fine with HtmlUnitDriver but gives an error whenever a browser version is specified with the HtmlUnitDriver

Steps to reproduce -

sample code is as below:

package test1;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.gargoylesoftware.htmlunit.BrowserVersion;

public class SampleTest {

public SampleTest()
{
	
}
@Test

public void verify()
{
            //WebDriver driver = new HtmlUnitDriver(); -- works fine in this case
	WebDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_38);
	
	driver.get("http://www.google.com");
	System.out.println(driver.getTitle());

	 driver.findElement(By.name("q")).clear();
	    driver.findElement(By.name("q")).sendKeys("selenium");
	    driver.findElement(By.name("btnG")).click();
	    System.out.println(driver.getTitle());
	    String abc = driver.getTitle();
	    Assert.assertTrue(abc.contains("selenium"));
	    
	driver.quit();
}

}

The output error which i'm getting is,

[TestNG] Running:
C:\Users\naukhaiz.ahmad\AppData\Local\Temp\testng-eclipse--1506748139\testng-customsuite.xml

Google
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:6925] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:7638] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:10007] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:10543] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:22616] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:26696] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:39 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:27142] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:923] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:1636] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:4005] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:4541] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:10036] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:10528] Error in expression; ':' found after identifier "progid".
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:13846] Error in expression. (Invalid token " ". Was expecting one of: , "inherit", , , , , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, , , , .)
Jul 20, 2017 6:07:40 PM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://www.google.com.pk/?gws_rd=cr,ssl&ei=GatwWY2dOcyuUojqnYAG' [1:13870] Error in expression. (Invalid token " ". Was expecting one of: , "inherit", , , , , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, , , , .)
FAILED: verify
org.openqa.selenium.ElementNotVisibleException: You may only interact with visible elements
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'SS01-NBK-035', ip: '10.1.18.37', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
Driver info: driver.version: unknown
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.verifyCanInteractWithElement(HtmlUnitWebElement.java:280)
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.click(HtmlUnitWebElement.java:138)
at test1.phantomTest.verify(phantomTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)

===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0

[TestNG] Time taken by org.testng.reporters.XMLReporter@28864e92: 16 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@1888ff2c: 7 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@7cdbc5d3: 42 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@33a10788: 46 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@357246de: 6 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 8 ms


Please suggest a solution or a way around.

@barancev
Copy link
Member

Issue moved to SeleniumHQ/htmlunit-driver #51 via ZenHub

@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants