Unable to Click on Radio button using Selenium C#Official locator strategies for the webdriverHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Calling the base constructor in C#Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Unable to click image button
Potential new partner angry about first collaboration - how to answer email to close up this encounter in a graceful manner
How can I pack my food so it doesn't smell?
Prove two distinct pairs of natural numbers with these properties do not exist
Is it safe to remove the bottom chords of a series of garage roof trusses?
Why doesn't the Falcon-9 first stage use three legs to land?
Can pay be witheld for hours cleaning up after closing time?
Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")
Why would the US President need briefings on UFOs?
Why don't politicians push for fossil fuel reduction by pointing out their scarcity?
The teacher logged me in as administrator for doing a short task, is the whole system now compromised?
Was this pillow joke on Friends intentional or a mistake?
What is the evidence on the danger of feeding whole blueberries and grapes to infants and toddlers?
Why don't we use Cavea-B
Nuclear decay triggers
Sous vide chicken without an internal temperature of 165 °F (75 °C)
Can I submit a paper under an alias so as to avoid trouble in my country?
How could China have extradited people for political reason under the extradition law it wanted to pass in Hong Kong?
Why doesn't mathematics collapse down, even though humans quite often make mistakes in their proofs?
Running script line by line automatically yet being asked before each line from second line onwards
Can you feel passing through the sound barrier in an F-16?
Is there a SubImageApply?
To "hit home" in German
Sleeping solo in a double sleeping bag
Designing a prison for a telekinetic race
Unable to Click on Radio button using Selenium C#
Official locator strategies for the webdriverHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Calling the base constructor in C#Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Unable to click image button
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Below is my HTML snippet of my Application. My Scenario is to Click on the Radio button. The xpath which I am using is //input[@id='authorizedContact1'] but still I am unable to Click on the Radio button.
The HTML is:
<div class="radio">
<input id="authorizedContact1" name="authorizedContactValue" class="authorizedContact" type="radio">
<label for="authorizedContact1">
::before ==$0
"YES"
::after
</label>
</div>
Here is is my code which I am using in Selenium
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(100));
IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@id='authorizedContact1']")));
element.Click();
I am using the XPATH as //input[@id='authorizedContact1'] But still unable to Click on the Radio button can anyone Help me in this
c# selenium xpath css-selectors webdriverwait
|
show 6 more comments
Below is my HTML snippet of my Application. My Scenario is to Click on the Radio button. The xpath which I am using is //input[@id='authorizedContact1'] but still I am unable to Click on the Radio button.
The HTML is:
<div class="radio">
<input id="authorizedContact1" name="authorizedContactValue" class="authorizedContact" type="radio">
<label for="authorizedContact1">
::before ==$0
"YES"
::after
</label>
</div>
Here is is my code which I am using in Selenium
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(100));
IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@id='authorizedContact1']")));
element.Click();
I am using the XPATH as //input[@id='authorizedContact1'] But still unable to Click on the Radio button can anyone Help me in this
c# selenium xpath css-selectors webdriverwait
1
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
1
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23
|
show 6 more comments
Below is my HTML snippet of my Application. My Scenario is to Click on the Radio button. The xpath which I am using is //input[@id='authorizedContact1'] but still I am unable to Click on the Radio button.
The HTML is:
<div class="radio">
<input id="authorizedContact1" name="authorizedContactValue" class="authorizedContact" type="radio">
<label for="authorizedContact1">
::before ==$0
"YES"
::after
</label>
</div>
Here is is my code which I am using in Selenium
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(100));
IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@id='authorizedContact1']")));
element.Click();
I am using the XPATH as //input[@id='authorizedContact1'] But still unable to Click on the Radio button can anyone Help me in this
c# selenium xpath css-selectors webdriverwait
Below is my HTML snippet of my Application. My Scenario is to Click on the Radio button. The xpath which I am using is //input[@id='authorizedContact1'] but still I am unable to Click on the Radio button.
The HTML is:
<div class="radio">
<input id="authorizedContact1" name="authorizedContactValue" class="authorizedContact" type="radio">
<label for="authorizedContact1">
::before ==$0
"YES"
::after
</label>
</div>
Here is is my code which I am using in Selenium
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(100));
IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@id='authorizedContact1']")));
element.Click();
I am using the XPATH as //input[@id='authorizedContact1'] But still unable to Click on the Radio button can anyone Help me in this
c# selenium xpath css-selectors webdriverwait
c# selenium xpath css-selectors webdriverwait
edited Mar 28 at 6:41
DebanjanB
58.1k16 gold badges59 silver badges110 bronze badges
58.1k16 gold badges59 silver badges110 bronze badges
asked Mar 27 at 15:28
Rajaram KannuriRajaram Kannuri
83 bronze badges
83 bronze badges
1
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
1
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23
|
show 6 more comments
1
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
1
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23
1
1
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
1
1
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23
|
show 6 more comments
1 Answer
1
active
oldest
votes
Since you need to Click() on the element you need to induce WebDriverWait for ElementToBeClickable() and you can use either of the Locator Strategies:
CssSelector:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("label[for='authorizedContact1']"))).Click();XPath:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//label[@for='authorizedContact1']"))).Click();
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380930%2funable-to-click-on-radio-button-using-selenium-c-sharp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Since you need to Click() on the element you need to induce WebDriverWait for ElementToBeClickable() and you can use either of the Locator Strategies:
CssSelector:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("label[for='authorizedContact1']"))).Click();XPath:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//label[@for='authorizedContact1']"))).Click();
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
add a comment |
Since you need to Click() on the element you need to induce WebDriverWait for ElementToBeClickable() and you can use either of the Locator Strategies:
CssSelector:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("label[for='authorizedContact1']"))).Click();XPath:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//label[@for='authorizedContact1']"))).Click();
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
add a comment |
Since you need to Click() on the element you need to induce WebDriverWait for ElementToBeClickable() and you can use either of the Locator Strategies:
CssSelector:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("label[for='authorizedContact1']"))).Click();XPath:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//label[@for='authorizedContact1']"))).Click();
Since you need to Click() on the element you need to induce WebDriverWait for ElementToBeClickable() and you can use either of the Locator Strategies:
CssSelector:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("label[for='authorizedContact1']"))).Click();XPath:new WebDriverWait(_driver, TimeSpan.FromSeconds(100)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//label[@for='authorizedContact1']"))).Click();
edited Mar 28 at 7:14
answered Mar 28 at 6:43
DebanjanBDebanjanB
58.1k16 gold badges59 silver badges110 bronze badges
58.1k16 gold badges59 silver badges110 bronze badges
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
add a comment |
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
1
1
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
Thank you so much @DebanjanB Really your answer sorted out my Problem
– Rajaram Kannuri
Mar 28 at 16:21
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380930%2funable-to-click-on-radio-button-using-selenium-c-sharp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What is the question? Please edit your post and add it there.
– Bogdan Doicin
Mar 27 at 15:30
Nobody can help you with that little information. Please give more information about the problem, including error messages and/or reproduction steps.
– Simon
Mar 27 at 15:31
Yes, please post the script where you are using that xpath.
– C. Peck
Mar 27 at 16:11
@C.Peck again Edited please check
– Rajaram Kannuri
Mar 27 at 16:35
1
Is there more than one input in the html? If not use By.Tag. Else, open DevTools. Hover over the element to get its CssSelector. Try using that instead of its xpath. Try using FindElements instead of FindElement to make sure there are not multiple answers. Check that element is not null before trying to click on it.
– SlightlyKosumi
Mar 27 at 20:23