0

I have a website that contains reports (with columns and rows). There is a menu on top of the page for different page controls (see image here https://ibb.co/hfjGScd). Among the page controls, there is one where user can select "partial" or "full" view of the report. When the page is loaded, the default view is "partial" report.

I want to automate selecting the "full" report using selenium and python, but I cannot find the element. The issue is that when the page is loaded in default "partial" report, I cannot find the html element related to "full" report. The html element becomes available in the source html only when the user selects it from the drop-down list. And when the "full" report is selected, the html element for the "partial" report disappears from the source html.

Here is html code for the default "partial report":

<div id="jro_view_partialdata" style="float:left;height:20px;padding:1px 0px;">
    <div id="_g0rmph" class="jsvm--com partialDataCtrlBox" style="position: relative; left: 0px; top: 0px; height: 18px; z-index: 0;"><div id="cboScopeType" class="jsvm--com jsvm_flatCombo partialDataCtrlBox_cboScopeType" style="position: absolute; width: 88px; height: 16px; z-index: 0;"><div id="dItemContainer" class="jsvm--com jsvm_flatCombo_dItemContainer partialDataCtrlBox_cboScopeType_dItemContainer" style="position: absolute; z-index: 0; width: 68px; height: 12px;"><div id="_q5cgw5" class="jsvm--com jsvm_flatCombo_dItem partialDataCtrlBox_cboScopeType_dItem" style="position: absolute; z-index: 0; width: 68px; height: 12px;"><span id="label" class="jsvm--com jsvm_flatCombo_dItem_label partialDataCtrlBox_cboScopeType_dItem_label" noncomp="true" style="position: absolute; display: block; white-space: nowrap; line-height: 16px; top: -2px; width: 68px;">Partial&nbsp;Data</span></div></div><div id="btnDropDown" class="jsvm--com jsvm_flatCombo_dropdown partialDataCtrlBox_cboScopeType_dropdown" style="position: absolute; z-index: 0; left: 72px; height: 16px;"><img id="icon" class="jsvm--com jsvm_flatCombo_dropdown_icon partialDataCtrlBox_cboScopeType_dropdown_icon" src="https://acell.mastercontrol.com/acell_analytics/webos/style/default/images/0-dropdown_new.png" style="position: absolute; display: block; left: 0px; top: 0px;"></div></div><div id="iptRecords" class="jsvm--com jsvm_textfield partialDataCtrlBox_iptRecords" style="position: absolute; z-index: 0; left: 92px;"><input type="text" name="iptRecords_input" id="iptRecords_input" autocomplete="off" class="jsvm--txt jsvm_textfield_input partialDataCtrlBox_iptRecords_input" style="position: absolute; left: 2px; top: 0px; margin: 0px; border: 0px none; outline: none; resize: none; overflow: hidden; width: 32px; height: 14px; line-height: 14px;"></div></div></div>

And here is the html code when "full report" is selected by the user:

<div id="jro_view_partialdata" style="float:left;height:20px;padding:1px 0px;">
    <div id="_g0rmph" class="jsvm--com partialDataCtrlBox" style="position: relative; left: 0px; top: 0px; height: 18px; z-index: 0; width: 90px;"><div id="cboScopeType" class="jsvm--com jsvm_flatCombo partialDataCtrlBox_cboScopeType" style="position: absolute; width: 88px; height: 16px; z-index: 0;"><div id="dItemContainer" class="jsvm--com jsvm_flatCombo_dItemContainer partialDataCtrlBox_cboScopeType_dItemContainer" style="position: absolute; z-index: 0; width: 68px; height: 12px;"><div id="_nshuew" class="jsvm--com jsvm_flatCombo_dItem partialDataCtrlBox_cboScopeType_dItem" style="position: absolute; z-index: 0; width: 68px; height: 12px;"><span id="label" class="jsvm--com jsvm_flatCombo_dItem_label partialDataCtrlBox_cboScopeType_dItem_label" noncomp="true" style="position: absolute; display: block; white-space: nowrap; line-height: 16px; top: -2px; width: 68px;">Full&nbsp;Data</span></div></div><div id="btnDropDown" class="jsvm--com jsvm_flatCombo_dropdown partialDataCtrlBox_cboScopeType_dropdown" style="position: absolute; z-index: 0; left: 72px; height: 16px;"><img id="icon" class="jsvm_flatCombo_dropdown_icon partialDataCtrlBox_cboScopeType_dropdown_icon" src="https://acell.mastercontrol.com/acell_analytics/webos/style/default/images/0-dropdown_new.png" style="position: absolute; display: block; left: 0px; top: 0px;"></div></div><div id="iptRecords" class="jsvm--com jsvm_textfield partialDataCtrlBox_iptRecords jsvm_textfield_16" style="position: absolute; z-index: 0; left: 92px; display: none;"><input type="text" name="iptRecords_input" id="iptRecords_input" autocomplete="off" class="jsvm--txt jsvm_textfield_input partialDataCtrlBox_iptRecords_input" style="position: absolute; left: 2px; top: 0px; margin: 0px; border: 0px none; outline: none; resize: none; overflow: hidden; width: 32px; height: 14px; line-height: 14px;"></div></div></div>

I am using the following code to click on the drop-down menu:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[1]/div[3]/table/tbody/tr/td/div[1]/div[17]/div/div[1]/div[1]/div/span"))).click()

which works fine. After running the above code, the drop down menu is clicked and I can see both "Full" and "Partial" options; but I don't know how to select the "Full" report.

Any help is appreciated.

4
  • 2
    How can we know what element do you want to click inside the HTML? Also, please share your Selenium existing code Commented Oct 20, 2022 at 14:28
  • I want to select the Full Data from the drop-down menu (see attached image in OP). Issue is I cannot select any element from this HTML (driver.find_element('id','any_id_in_the_html')); error is element cannot be found. I was wondering if this might also be a tricky scenario like iframe which first needs switching to something. Commented Oct 20, 2022 at 14:51
  • 1
    Update the question by adding the HTML Source for the element you want to click and the code that you tried so far with error that you're getting ? Commented Oct 21, 2022 at 7:45
  • Updated the post with some relevant details. Thanks Commented Oct 24, 2022 at 14:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.