MRAJ Posted July 9, 2021 Posted July 9, 2021 Hello, I am using WD UDF for edge browser. I running a script which will search the text which is in b tag like: <b>test</b>. I tried with below but it is not finding the text . In IE i am using like the below script and its working but using WD UDF edge browser its not working. I am not sure where the scripts are wrong. Local $pageSource = _IEBodyReadHTML($oIE) If StringInStr($pageSource, "<b>test</b>") Using Edge Browser $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//title[contains(text(), "test")]') and _WD_Attach($sSession, $sString, $sMode = 'html')
Developers Jos Posted July 9, 2021 Developers Posted July 9, 2021 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Danp2 Posted July 9, 2021 Posted July 9, 2021 I'm not sure that I understand your end goal, but the Webdriver equivalent of _IEBodyReadHTML is _WD_GetSource. Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted July 9, 2021 Author Posted July 9, 2021 Hello Dan, My Goal is to find the text and if not found then result an error.
Danp2 Posted July 9, 2021 Posted July 9, 2021 Ok... you showed _WD_Attach as a portion of your example, which confused me. 🙂 You should be able to use _WD_GetSource and StringInStr to mimic what you were doing with IE previously. It's possible that you could use _WD_FindElement as well, but you would need the correct selector for it to work properly. Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted July 9, 2021 Author Posted July 9, 2021 Hello Dan, Thanks I configured many scripts using WD UDF and its working fine. I am also using _WD_FindElement to other scripts and no issue. but this B tag HTML i was not able to find the correct selector and how to write. I used the below script, not sure if it correct or not. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, '//title[contains(text(), "test")]') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//title[contains(text(), "test")]')
Danp2 Posted July 9, 2021 Posted July 9, 2021 Your first example is clearly wrong because you aren't supplying a tag name. Can you show the relevant HTML? It's difficult to know why the 2nd one isn't working without more details. Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted July 9, 2021 Author Posted July 9, 2021 <td align="center"><font face="ARIAL" size="5"><b>test</b></font></td> This is the HTML code
Danp2 Posted July 9, 2021 Posted July 9, 2021 That's not nearly enough HTML to help you. It just suggests that the desired element is part of an HTML table. Are you using a tool like ChroPath to assist you in finding the correct xpath? Latest Webdriver UDF Release Webdriver Wiki FAQs
MRAJ Posted July 9, 2021 Author Posted July 9, 2021 I am using the inspect tool and then highlight the part and getting the HTML result.
Danp2 Posted July 9, 2021 Posted July 9, 2021 We can't help you further without more details. You can either save the page's HTML to a file and post it here or provide a URL to a website that we can use for testing / demonstration purposes. P.S. Did you look into using _WD_GetSource? Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now