Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98372

Get Value from Output Box using Selenium (Python)

$
0
0

I am trying to extract the text that is generated in a text box based on values I enter into another text box. I looked in the inspect element and there is no signs of the values at all, and the 'Value' has nothing in it even though the box is populated.

I am using selenium in Python to try perform this. I am only working with 1 currently, but will be setting up a loop to do thousands hence why I need this automated.

Below is the code in the page (Ordinance Survey Ireland Website)

<td width="25%" class="form">Latitude:</td><td class="form"><input type="text" name="GeodeticLatitude" type="number" size="10" maxlength="2" value="">
   deg<input type="text" name="GeodeticLatitudeMin" size="2" maxlength="2" value="0">
   min<input type="text" name="GeodeticLatitudeSec" size="8" maxlength="8" value="0">
   sec</td>

Below is the code that I am currently working with to attempt to extract the values

browser = webdriver.Chrome()

browser.get("https://gnss.osi.ie/new-converter/")

def find():
    python_button = browser.find_elements_by_xpath("//input[@name='IrishGridEasting']")[0]
    python_button.send_keys("316600")
    python_button = browser.find_elements_by_xpath("//input[@name='IrishGridNorthing']")[0]
    python_button.send_keys("229500")
    python_button = browser.find_elements_by_xpath("//td[@class='form']/button[@type='button']")[1]
    python_button.click()

    latDeg = browser.find_elements_by_xpath("//input[@name='GeodeticLatitude']")
    print(latDeg)

I have attempted to add in options such as .text, .getText(), .getAttribute and .get_attribute but they do not return the text box value

Then below screenshot shows what I am trying to retrieve.

The red boxes is the number I am inserting, the green box represents what I want to extract.

Screenshot of webpage


Viewing all articles
Browse latest Browse all 98372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>