Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97771

Unable to locate element: {"method":"css selector","selector":"#id_gender1"}

$
0
0

I'm trying to select a checkbox / radio button by all the possible ways that I can think of, but none of them have worked.

This is the way I am trying to identity de checkbox

WebElement selectGender = driver.findElement(By.id("id_gender1"));
selectGender.click();

Here is the HTML code

<div class="radio-inline">
    <label for="id_gender1" class="top">
     <div class="radio" id="uniform-id_gender1"><span class="checked"><input type="radio" name="id_gender" id="id_gender1" value="1">
     </span>
     </div>
       Mr.
   </label>
</div>

This is the error message I am receiving.

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#id_gender1"}
  (Session info: chrome=75.0.3770.142)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'JEFFERSONPC', ip: '192.168.100.6', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_211'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.142, chrome: {chromedriverVersion: 75.0.3770.140 (2d9f97485c7b..., userDataDir: C:\Users\JEFFER~1\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:63666}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 65163859269265511fa3118a5c9b1f79
*** Element info: {Using=id, value=id_gender1}

Viewing all articles
Browse latest Browse all 97771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>