pythonoracle-databaseseleniumelementsiebel

How to extract text from input container using selenium?


I'm trying to extract data from a container but i am receiving None or ''. I can find the label element but cant get the data out of the div input element

I have tried using xpaths and names, text() and get_attribute but returns either None or ''. Using get_property i get error MaxRetryError:

HTTPConnectionPool(host='127.0.0.1', port=49977): Max retries exceeded....

I have tried:

browser.find_element_by_name('s_2_1_16_0').get_attribute("Product Category")
browser.find_element_by_name('s_2_1_16_0').get_property("Product Category")
browser.find_element_by_xpath("//*[@id=\"a_2\"]/div/table/tbody/tr[6]/td[5]/div").get_attribute("Product Category")

browser.find_element_by_xpath("//*[@id=\"a_2\"]/div/table/tbody/tr[6]/td[5]/div").text
browser.find_element_by_xpath("//div[@class='mceGridField siebui-value mceField']/input[@name='s_2_1_16_0']").text
browser.find_element_by_name('s_2_1_16_0').text

and multiple variations of the same.

i can access and print the "Product Category" label here:

screen cap

<div class="mceGridField siebui-value mceField">
    <input type="text" name="s_2_1_16_0" value="" aria-labelledby="Product_Category_Label" aria-label="Product Category" style="height: 24px; width:144px;" class="siebui-ctrl-input siebui-align-left siebui-input-align-left s_2_1_16_0" maxlength="50" tabindex="0" data-seq="1013" readonly="readonly" aria-readonly="true">
</div>

I want to extract the word "Data" from that input box, and then the data from multiple other similar fields on the same page (i have tried several of these fields and get the same result each time)

NOTE: This page is a Siebel online UI and data comes from an Oracle database (which i cannot access directly)


Solution

  • I think the "Data" is the input value.

    input = driver.find_element_by_name("s_2_1_16_0").get_attribute('value')