Can't get text in a "readonly" input element

Viewed 134

I am making a web-automation script that retrieves text that appears after clicking a button, however the text is inside an input element like:

<input type="TEXT" autocomplete="off" class="DFGUISLE Readonly1" name="Readonly1" id="Readonly1" maxlength="150" readonly="" tabindex="-1" style="dir:ltr;   position:absolute; left:276; top:552; width:899; height:24;  ">

Screenshot of the input element

Problem is, when I try:

output_fields = driver.find_elements(By.TAG_NAME, 'input')
for output_field in output_fields:
    print(driver.execute_script("return arguments[0].value", output_field))
    >> (blank)
    print(driver.execute_script("return arguments[0].innerText", output_field))
    >> (blank)
    print(output_field.get_attribute('value').encode('utf-8'))
    >> b''
    print(output_field.get_attribute('innerText').encode('utf-8'))
    >> b''

I get blank outputs. Any clue on how to get the text from these input elements? Like, in this case, I am looking for the Merk en type : AUDI

EDIT 1:

I also noticed that in Network Logger, after I click "Opvragen", the text can be seen from a response as follows:

parent.instanciate(new Array('EntryField','1689296692','CMV_WD_PBL01_CONSULT_STATUS','Readonly1',"Merk en type : AUDI")).setAttributes(false,'','','none','noop',null,null);

EDIT 2:

If you would like to try, Link: mobilit.fgov.be/WebdivPub/wmvpstv1 and put WAUZZZ8VXE1009546 into Chassisnummer then press Opvragen

1 Answers

sorry I don't know the input formula,but I can get the field text already u need to switch to the try this enjoy~

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.chrome.service import Service 
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
class roomnumber: 
    def __init__(self,url,selepath='chromedriver.exe'):
        self.url=url

        
        self.seleniumpath=selepath
        ser = Service(self.seleniumpath)
        #self.keyword=keyw
        self.driver=webdriver.Chrome(service = ser)
        #self.driver.maximize_window()
        self.driver.get(self.url)

    def getspon(self):
        
        
        self.driver.switch_to.frame("AppWindow")
        
        calltheporn=self.driver.find_element(By.XPATH,'//*[@id="Writable3"]')
        calltheporn.send_keys('1321434534')
        
        drinksoup=self.driver.find_element(By.XPATH,'//*[@id="btnOphalen"]')
        self.driver.execute_script("arguments[0].click();",drinksoup)
        
        
    def totheroomgettheporn(self):
        print('oh no!!!!!!!!!!!!!!!')
        self.driver.close()
        
    

x=roomnumber('https://www.mobilit.fgov.be/WebdivPub/wmvpstv1?SUBSESSIONID=1964746')
x.ddget()
x.getspon()
x.totheroomgettheporn()
Related