Jump to content
CharlesXavier

.innerText -> Number

Recommended Posts

CharlesXavier

Does somebody knows how to convert a number in a innerText from string to integer? I tried with Number($something.innerText) and Int($something.innerText) but none of them works for me.

Share this post


Link to post
Share on other sites
jdelaney

How do you know it is or is not being converted.  Need way more info.  Preferably a script snippet that can run and reproduce what you think is an issue.

Works for me:

#include <IE.au3>
$oIE = _IECreate()
_IEBodyWriteHTML($oIE,"<abc id='test'>1234</abc>")
$o = _IEGetObjById($oIE,'test')
$i = Number($o.InnerText)
ConsoleWrite($i & " " & IsNumber($i) & " " & ($i==1234) & @CRLF)

output:

1234 1 True

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
CharlesXavier

Thanks for answering, i already fixed it. The problem was that the innertext wasnt just "1234" but "   1234    ", so i removed the spaces and converted it after.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.