Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I have a html which has multiple checkbox classes each with different texts that is, each check box with a different name. This is the HTML,
<div class="col-md-12 syllabus-div-1"> <h4 class="vertical-spacing">Coaching<i class="fa fa-graduation-cap" aria-hidden="true" style="margin-left:5px; cursor:pointer" data-topic-url="/coach-topic-detail/41/"></i>h4> <div class="checkbox"> <label> <input type="checkbox" checked="" disabled="">Manage the Coaching Process<a href="https://pluma.myhbp.org/hmm12/content/coaching/coaching_done_right.html" target="_blank"><i class="fa fa-external-link" aria-hidden="true" style="margin-left:5px;"></i>a> label> <p>Skipped on 03/16/2017p> div> <div class="checkbox"> <label> <input type="checkbox" checked="" disabled="">Coaching Done Right<a href="https://pluma.myhbp.org/hmm12/content/coaching/manage_the_coaching_process.html" target="_blank"><i class="fa fa-external-link" aria-hidden="true" style="margin-left:5px;"></i>a> label> <p>Skipped on 03/16/2017p> div> <div class="checkbox"> <label> <input type="checkbox" checked="" disabled="">Listen and Question Effectively<a href="https://pluma.myhbp.org/hmm12/content/coaching/listen_and_question_effectively.html" target="_blank"><i class="fa fa-external-link" aria-hidden="true" style="margin-left:5px;"></i>a> label> <p>Skipped on 03/16/2017 REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
Based on the HTML you provided, you're not able to check/uncheck the checkboxes by clicking them because they are disabled. Moreover, all the checkboxes are already checked.
To answer your question, though, you are able to click the checkbox based the text inside the label. You can find a list of all the labels containing the checkboxes using the css selector '.checkbox label', which should return a list of labels.
'.checkbox label'
Then, you can iterate over the list of labels, checking if each label has the innerText attribute with the value you, eg. 'Manage the Coaching Process'. If it has your desired innerText value, then you can store that element in a variable and kill your loop.
innerText
'Manage the Coaching Process'
Once you have the selected label element you can use it to find the input checkbox among it's children and store it. No you have the checkbox. Click it and you're done.
input
Code Sample
Note: This sample is only meant to illustrate the logic. It's likely incorrect in terms of syntax because I don't know what JS implementation of selenium you're using.
var labels = driver.findElements(By.cssSelector('.checkbox label')); # assumes that only one label will fit the criteria of having the desired innerText var myLabel = labels.filter(function(label) { return label.getAttribute('innerText') == 'Manage the Coaching Process'; })[0]; var myCheckbox = myLabel.findElement(By.cssSelector('input[type=\'checkbox\']')); myCheckbox.click();
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.