Excel Selenium VBA Run-time error '32'

Js Smith

New Member
Joined
Jul 24, 2020
Messages
44
Office Version
  1. 2010
Platform
  1. Windows
Hi all!

I am attempting a script in Excel using selenium to automate some website testing and ran into a problem with a series of dropdowns.

Not sure what is most helpful so I included everything I could find. Please excuse if there's too much info here. The problem is the number of dropdowns will vary and each "person" is assigned a 10 digit variable. I will have a sheet in the workbook with data so the script will know what relation to choose. The rest of the code to this point is working as anticipated so, I can adapt any code ideas provided, I just can't figure out a smart way to tackle these dropdowns.

Below is what I see using the Inspect function in Chrome. 1000174402 and 1000174429 are the variables assigned to self and spouse, respectively, by the app:
HTML:
HTML:
<select id="page_06_relation_1000174402_to_1000174429" name="relation_1000174402_to_1000174429" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select>

Xpath
Code:
//*[@id="page_06_relation_1000174402_to_1000174429"]

Full Xpath:
Code:
/html/body/div[1]/div/main/div[1]/div/div/div[2]/div[1]/div/form/div[2]/select

This is how the Selenium Chrome addon sees it on a recording, selecting "Spouse" from the list :

Rich (BB code):
    "id": "82d2b6c3-c22d-4107-a8c2-ca1674ae7f00",
      "comment": "",
      "command": "click",
      "target": "id=page_06_relation_1000174402_to_1000174429",
      "targets": [
        ["id=page_06_relation_1000174402_to_1000174429", "id"],
        ["name=relation_1000174402_to_1000174429", "name"],
        ["css=#page_06_relation_1000174402_to_1000174429", "css:finder"],
        ["xpath=//select[@id='page_06_relation_1000174402_to_1000174429']", "xpath:attributes"],
        ["xpath=//div[@id='fhRelationship']/div/form/div[2]/select", "xpath:idRelative"],
        ["xpath=//select", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "ca159432-cfb6-4454-845f-4e3b2f96609b",
      "comment": "",
      "command": "select",
      "target": "id=page_06_relation_1000174402_to_1000174429",
      "targets": [],
      "value": "label=Spouse"
    }, {

For my own sanity, I've reduced the test to a family structure of married vs unmarried and somewhere between 0-4 children. That gives me a range of 1-20 xpath divs.

For a married couple with 4 kids the pattern looks like this:
div1 = Self and does not appear in the GUI
test botYHIone is Spouse botYHIone's = div2
test botYHIone is ChildOne botYHIone's = div3
test botYHIone is ChildTwo botYHIone's = div4
test botYHIone is ChildThree botYHIone's = div5
test botYHIone is ChildFour botYHIone's = div6
div7 = Spouse and does not appear in the GUI
Spouse botYHIone is ChildOne botYHIone's = div8
Spouse botYHIone is ChildTwo botYHIone's = div9
Spouse botYHIone is ChildThree botYHIone's = div10
Spouse botYHIone is ChildFour botYHIone's = div11
div12 = ChildOne and does not appear in the GUI
ChildOne botYHIone is ChildTwo botYHIone's = div13
ChildOne botYHIone is ChildThree botYHIone's = div14
ChildOne botYHIone is ChildFour botYHIone's = div15
div16 = ChildTwo and does not appear in the GUI
ChildTwo botYHIone is ChildThree botYHIone's = div17
ChildTwo botYHIone is ChildFour botYHIone's = div18
div19 = ChildThree and does not appear in the GUI
ChildThree botYHIone is ChildFour botYHIone's = div20

I was trying to dodge the variables issues to make this vba more universally functional. So tried to use the Full Xpath:

VBA Code:
bot.FindElementByXPath("[/html/body/div[1]/div/main/div[1]/div/div/div[2]/div[1]/div/form/div[2]/select]").Click

That's were the runtime error appears. I've included snips of the GUI and the error.

I'm sure there's a better way to tackle this. How would you click through these dropdowns, select the appropriate relationship and avoid having to mess with the variable issue?

Thanks in advance for your help!!
 

Attachments

  • RunTime32.PNG
    RunTime32.PNG
    4.7 KB · Views: 7
  • GUI.PNG
    GUI.PNG
    24.8 KB · Views: 6
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
This is the entire form, in case it's helpful:

HTML:
<form autocomplete="off"><div class="grid-col-12 margin-t-20"><p data-instructions="instructional_text.how_is_related">1. How is <strong>test botYHIone</strong> related to the other household members?<a href="#" class="instruction_link instruction_link_p" id="instructional_text.how_is_related">Learn more</a></p><div class="text-collapse"><div class="hidden"><p>Here's some more information about a few of these relationships: <br> <br><strong>Ward:</strong> A person who’s under the care or responsibility of a parent or court-appointed guardian. Wards may be either minor children or disabled adults.<br> <br> <strong>Court-appointed guardian:</strong> An adult who’s been given legal responsibility by the court to mange the affairs of another person. Usually this is an adult who’s given legal responsibility to care for a child, but the guardian can also be an adult with legal responsibility to manage the affairs of another adult.</p><a class="expandable__btn--close" href="#"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11 " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg></a></div></div></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174402_to_1000174429" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">test botYHIone is Spouse botYHIone's</label><select id="page_06_relation_1000174402_to_1000174429" name="relation_1000174402_to_1000174429" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174402_to_1000174430" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">test botYHIone is ChildOne botYHIone's</label><select id="page_06_relation_1000174402_to_1000174430" name="relation_1000174402_to_1000174430" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174402_to_1000174431" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">test botYHIone is ChildTwo botYHIone's</label><select id="page_06_relation_1000174402_to_1000174431" name="relation_1000174402_to_1000174431" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174402_to_1000174432" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">test botYHIone is ChildThree botYHIone's</label><select id="page_06_relation_1000174402_to_1000174432" name="relation_1000174402_to_1000174432" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174402_to_1000174433" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">test botYHIone is ChildFour botYHIone's</label><select id="page_06_relation_1000174402_to_1000174433" name="relation_1000174402_to_1000174433" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-col-12 margin-t-20"><p data-instructions="instructional_text.how_is_related">2. How is <strong>Spouse botYHIone</strong> related to the other household members?<a href="#" class="instruction_link instruction_link_p" id="instructional_text.how_is_related">Learn more</a></p><div class="text-collapse"><div class="hidden"><p>Here's some more information about a few of these relationships: <br> <br><strong>Ward:</strong> A person who’s under the care or responsibility of a parent or court-appointed guardian. Wards may be either minor children or disabled adults.<br> <br> <strong>Court-appointed guardian:</strong> An adult who’s been given legal responsibility by the court to mange the affairs of another person. Usually this is an adult who’s given legal responsibility to care for a child, but the guardian can also be an adult with legal responsibility to manage the affairs of another adult.</p><a class="expandable__btn--close" href="#"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11 " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg></a></div></div></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174429_to_1000174430" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">Spouse botYHIone is ChildOne botYHIone's</label><select id="page_06_relation_1000174429_to_1000174430" name="relation_1000174429_to_1000174430" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174429_to_1000174431" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">Spouse botYHIone is ChildTwo botYHIone's</label><select id="page_06_relation_1000174429_to_1000174431" name="relation_1000174429_to_1000174431" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174429_to_1000174432" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">Spouse botYHIone is ChildThree botYHIone's</label><select id="page_06_relation_1000174429_to_1000174432" name="relation_1000174429_to_1000174432" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174429_to_1000174433" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">Spouse botYHIone is ChildFour botYHIone's</label><select id="page_06_relation_1000174429_to_1000174433" name="relation_1000174429_to_1000174433" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-col-12 margin-t-20"><p data-instructions="instructional_text.how_is_related">3. How is <strong>ChildOne botYHIone</strong> related to the other household members?<a href="#" class="instruction_link instruction_link_p" id="instructional_text.how_is_related">Learn more</a></p><div class="text-collapse"><div class="hidden"><p>Here's some more information about a few of these relationships: <br> <br><strong>Ward:</strong> A person who’s under the care or responsibility of a parent or court-appointed guardian. Wards may be either minor children or disabled adults.<br> <br> <strong>Court-appointed guardian:</strong> An adult who’s been given legal responsibility by the court to mange the affairs of another person. Usually this is an adult who’s given legal responsibility to care for a child, but the guardian can also be an adult with legal responsibility to manage the affairs of another adult.</p><a class="expandable__btn--close" href="#"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11 " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg></a></div></div></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174430_to_1000174431" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildOne botYHIone is ChildTwo botYHIone's</label><select id="page_06_relation_1000174430_to_1000174431" name="relation_1000174430_to_1000174431" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174430_to_1000174432" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildOne botYHIone is ChildThree botYHIone's</label><select id="page_06_relation_1000174430_to_1000174432" name="relation_1000174430_to_1000174432" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174430_to_1000174433" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildOne botYHIone is ChildFour botYHIone's</label><select id="page_06_relation_1000174430_to_1000174433" name="relation_1000174430_to_1000174433" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-col-12 margin-t-20"><p data-instructions="instructional_text.how_is_related">4. How is <strong>ChildTwo botYHIone</strong> related to the other household members?<a href="#" class="instruction_link instruction_link_p" id="instructional_text.how_is_related">Learn more</a></p><div class="text-collapse"><div class="hidden"><p>Here's some more information about a few of these relationships: <br> <br><strong>Ward:</strong> A person who’s under the care or responsibility of a parent or court-appointed guardian. Wards may be either minor children or disabled adults.<br> <br> <strong>Court-appointed guardian:</strong> An adult who’s been given legal responsibility by the court to mange the affairs of another person. Usually this is an adult who’s given legal responsibility to care for a child, but the guardian can also be an adult with legal responsibility to manage the affairs of another adult.</p><a class="expandable__btn--close" href="#"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11 " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg></a></div></div></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174431_to_1000174432" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildTwo botYHIone is ChildThree botYHIone's</label><select id="page_06_relation_1000174431_to_1000174432" name="relation_1000174431_to_1000174432" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174431_to_1000174433" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildTwo botYHIone is ChildFour botYHIone's</label><select id="page_06_relation_1000174431_to_1000174433" name="relation_1000174431_to_1000174433" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div><div class="grid-col-12 margin-t-20"><p data-instructions="instructional_text.how_is_related">5. How is <strong>ChildThree botYHIone</strong> related to the other household members?<a href="#" class="instruction_link instruction_link_p" id="instructional_text.how_is_related">Learn more</a></p><div class="text-collapse"><div class="hidden"><p>Here's some more information about a few of these relationships: <br> <br><strong>Ward:</strong> A person who’s under the care or responsibility of a parent or court-appointed guardian. Wards may be either minor children or disabled adults.<br> <br> <strong>Court-appointed guardian:</strong> An adult who’s been given legal responsibility by the court to mange the affairs of another person. Usually this is an adult who’s given legal responsibility to care for a child, but the guardian can also be an adult with legal responsibility to manage the affairs of another adult.</p><a class="expandable__btn--close" href="#"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times" class="svg-inline--fa fa-times fa-w-11 " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512"><path fill="currentColor" d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path></svg></a></div></div></div><div class="grid-row gi-component gi-dropdown"><label for="page_06_relation_1000174432_to_1000174433" class="tablet:grid-col-4 gi-dropdown__label undefined iconed-false required-true">ChildThree botYHIone is ChildFour botYHIone's</label><select id="page_06_relation_1000174432_to_1000174433" name="relation_1000174432_to_1000174433" aria-required="true" class="tablet:grid-col-6 gi-dropdown__select undefined"><option value="default">Relation</option><option value="19">Child (son or daughter)</option><option value="31">Court-Appointed Guardian</option><option value="53">Domestic partner</option><option value="05">Grandchild (grandson or granddaughter)</option><option value="04">Grandparent (grandfather or grandmother)</option><option value="13">Mother-in-law or Father-in-law</option><option value="03">Parent (father or mother)</option><option value="14">Sibling (brother or sister)</option><option value="11">Son-in-law or Daughter-in-law</option><option value="01">Spouse</option><option value="17">Stepchild (stepson or stepdaughter)</option><option value="16">Stepparent (stepfather or stepmother)</option><option value="15">Ward</option><option value="G9">Other</option></select></div></form>
 
Upvote 0
I've made some progress. This bit works...sorta... it manipulates the first and second dropdown, but both end up set as Parent:

VBA Code:
bot.FindElementsByCss("[class='grid-row gi-component gi-dropdown']")(1).Click
   bot.FindElementByXPath("//*[text()='Spouse']").Click

bot.FindElementsByCss("[class='grid-row gi-component gi-dropdown']")(2).Click
    bot.FindElementByXPath("//*[text()='Parent (father or mother)']").Click
bot.FindElementsByCss("[class='grid-row gi-component gi-dropdown']")(3).Click

any ideas from the gallery on how to set each dropdown to it's own value?

Thanks!
 
Upvote 0
Good to hear you fixed the error.
If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
I didn't solve the issue, just the runtime error, but that usually gets someone telling me to start a new thread.

FYI I used the dropdown class instead of the xpath to rid myself of the error but can't answer each dropdown.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,110
Messages
6,123,146
Members
449,098
Latest member
Doanvanhieu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top