0
votes

HTML Code:

<div class="radio">
<input id="passwordRadios1" class="password-radio" type="radio" value="guest" name="passwordRadios">
<input type="hidden" value=" " name="_D:passwordRadios">
<label for="passwordRadios1"> No (you can save your details later)</label>
</div>
<div class="form-inline">
<div class="radio">
<input id="passwordRadios2" class="password-radio" type="radio" value="register" name="passwordRadios">
<input type="hidden" value=" " name="_D:passwordRadios">
<label class="radio-inline" for="passwordRadios2">Yes, my password is:</label>
</div>
<div class="form-group">
<label class="sr-only" for="inputPassword">Password</label>
<input id="inputPassword" class="form-control fixed-width" type="password" value="" placeholder="Enter your password*" name="password" onblur="textboxValidator(id);">
<input type="hidden" value=" " name="_D:password">

its showing error in second line

 WebElement checkBox = driver.findElement(By.cssSelector("input[value='guest']"));
 checkBox.click();

Error:

Exception in thread "main" org.openqa.selenium.WebDriverException: Element is not clickable at point (168, 431.83331298828125). Other element would receive the click: Command duration or timeout: 78 milliseconds Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800' System info: host: 'TWVEN-DES-05', ip: '172.16.24.53', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.2, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 4857ae27-ea9a-4c3c-ba3d-e04148e04e45 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274) at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) at tesPack.Test1Class.main(Test1Class.java:43)

1
i tried in 2 ways: 1.Sometimes automation is closing the browser after sending text into textbox...no further process 2.With another code, able to just select radio button but still cursor in textbox field onlymani09

1 Answers

0
votes

I've seen something like this before, in my case it was because the element itself wasn't visible within the browser window, and scrolled out of frame. Try adding in actions.moveToElement(checkBox) before your click.