Jump to content

Help required in locating web element using chrome webdriver in dynamic web pages - (Moved)


Recommended Posts

I am using wd_core.au3 and wd_helper.au3.  I am trying to access the "Redwood - Run my jobs" job interface.

Some of the pages are created dynamically inside script like the below code snippet.  This is what the _WD_GetSource function returns.  So my Xpath seen on the actual page is not working.  How to tackle this?  Expert inputs required.  Thanks in advance.

</script></head><body class="UIMainPage" onload="handlePageLoad();" onunload="Custom.unloadWindow();" onresize="panel.layout();" oncontextmenu="return PopupMenu.popupFromElement(event);" onclick="if (event.which){if (event.which != 1) return;} else {if (event.button!=0)return;}PopupMenu.closeOpenMenu();" onkeydown="PopupMenu.closeOpenMenu();" actions="[['','','MainPage','MainPage','1',[['A','101302','1','',[],[]],['A','101303','1','',[],[]],['A','101305','1','',[null],[]],['A','101312','0','',[],[]],['A','101313','0','',[],[]],['A','101314','0','',[],[]],['A','101308','1','',[],[]],['A','101319','1','',[null,null],['Suggestions','<div class=\&quot;UIEditPageFrame UIEditPageFrame-TopBorder\&quot;><table class=\&quot;UIModalDialog-Structure-MainBar UIEditPagePanel UIEditPageFields AutoWidth\&quot;><colgroup><col class=\&quot;AutoWidth\&quot; /><col /></colgroup><tbody><tr><td colspan=\&quot;2\&quot; class=\&quot;NoMaxWidth NoClip\&quot;><div class=\&quot;UIModalDialog-Structure-MainBar-Cell\&quot;>When using suggestions identifying information will be sent. Are you sure you want to proceed?</div></td></tr><tr><td><input type=\&quot;checkbox\&quot; id=\&quot;suggestionConfirmationNeverAskAgain\&quot; name=\&quot;suggestionConfirmationNeverAskAgain\&quot; checked=\&quot;true\&quot; /><label for=\&quot;suggestionConfirmationNeverAskAgain\&quot;></label></td><td class=\&quot;UIModalDialog-Structure-MainBar-Label\&quot;><label for=\&quot;suggestionConfirmationNeverAskAgain\&quot;>Do not ask again</label></td></tr></tbody></table></div>',['OK'],[[null,null,null,'false','When using suggestions identifying information will be sent. Are you sure you want to proceed?','no-max-width-output','false','true','false'],['suggestionConfirmationNeverAskAgain','suggestionConfirmationNeverAskAgain','Do not ask again','true',null,'checkbox','false','true','false']]]],['A','101320','0','',[],[]],['A','101322','1','',[],[]],['A','101316','0','',[null],['Usage Data Collection','<div class=\&quot;UIEditPageFrame UIEditPageFrame-TopBorder\&quot;><table class=\&quot;UIModalDialog-Structure-MainBar UIEditPagePanel UIEditPageFields\&quot;><colgroup><col class=\&quot;AutoWidth\&quot; /></colgroup><tbody><tr><td class=\&quot;NoMaxWidth NoClip\&quot;><div class=\&quot;UIModalDialog-Structure-MainBar-Cell\&quot;>Help Redwood improve its products and services by automatically sending diagnostic and usage data? (This answer can be changed at any time)</div></td></tr><tr><td class=\&quot;UIModalDialog-Structure-MainBar-Cell\&quot;><p><a href=\&quot;#\&quot; onclick=\&quot;ContextHelp.showHelp(\'com.redwood.scheduler.ui.help.dummy.UsageData\');\&quot;>About diagnostics &amp; privacy...</a></p></td></tr></tbody></table></div>',['Yes','No'],[[null,null,null,'false','Help Redwood improve its products and services by automatically sending diagnostic and usage data? (This answer can be changed at any time)','no-max-width-output','false','true','false'],[null,null,'About diagnostics &amp; privacy...','false','ContextHelp.showHelp(\'com.redwood.scheduler.ui.help.dummy.UsageData\');','url','false','true','false']],'Ask me later','UIModalDialog-MinMaxWidth']],['A','101354','1','',[null,null,null,null],[]],['A','101366','1','',[null,null,null,null,null,null,null,null,null,null,null,null],[]],['A','101353','1','',[null,null,null],[]],['A','101361','1','',[null],[]],['A','101362','1','',[null,null],[]],['A','101355','1','',[null,null,null,null,null,null],[]],['A','101357','1','',[null,null,null,null],[]],['A','101359','0','',[null],[]],['A','101360','0','',[null],[]],['A','101363','0','',[],[]],['A','101358','1','',[null,null,null,null,null],[]],['A','101364','0','',[null],[]],['I','101323','1','',[null,null,null,null,null,null],['Search...', '']],['A','101367','1','',[],[]],['A','101368','0','',[],[]],['A','101372','1','',[null,null,null,null,null,null],[]],['A','101376','0','',[null,null],[]],['A','101377','0','',[null],[]]]]]"><div id="splash" class="UIMetaPageSplash" style="display: none;">

 

 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/29ec406d2a934b9d5b1c1dc9377d62ef/element; $sData={"using":"xpath","value":"/html/body/form/div/div[1]/div/table/tbody/tr/td[1]/a"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"/html/body/form/div/div[1]/div/table/tbody/tr/td[1]/a\"}\n  (Session info: chrome=110.0.5481.104)","stacktrace":"Backtrace:\n\t(No symbol) [0x014A6643]\n\t(No symbol) [0x0143BE21]\n\t(No symbol) [0x0133DA9D]\n\t(No symbol) [0x01371342]\n\t(No symbol) [0x0137147B]\n\t(No symbol) [0x013A8DC2]\n\t(No symbol) [0x0138FDC4]\n\t(No symbol) [0x013A6B09]\n\t(No symbol) [0x0138FB76]\n\t(No symbol) [0x013649C1]\n\t(No symbol) [0x01365E5D]\n\tGetHandleVerifier [0x0171A142+2497106]\n\tGetHandleVerifier [0x017485D3+2686691]\n\tGetHandleVerifier [0x0174BB9C+2700460]\n\tGetHandleVerifier [0x01553B10+635936]\n\t(No symbol) [0x01444A1F]\n\t(No symbol) [0x0144A418]\n\t(No symbol) [0x0144A505]\n\t(No symbol) [0x0145508B]\n\tBaseThreadInitThunk [0x770262C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77261B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77261B34+1028]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"/html/body/form/div/div[1]/div/table/tbody/tr/td[1]/a\"}\n  (Session info: chrome=110.0.5481.104)","stacktrace":"Backtrace:\n\t(No symbol) [0x014A6643]\n\t(No symbol) [0x0143BE21]\n\t(No symbol) [0x0133DA9D]\n\t(No symbol) [0x01371342]\n\t(No symbol) [0x0137147B]\n\t(No symbol) [0x013A8DC2]\n\t(No symbol) [0x0138FDC4]\n\t(No symbol) [0x013A6B09]\n\t(No symbol) [0x0138FB76]\n\t(No symbol) [0x013649C1]\n\t(No symbol) [0x01365E5D]\n\tGetHandleVerifier [0x0171A142+2497106]\n\tGetHandleVerifier [0x017485D3+2686691]\n\tGetHandleVerifier [0x0174BB9C+2700460]\n\tGetHandleVerifier [0x01553B10+635936]\n\t(No symbol) [0x01444A1F]\n\t(No symbol) [0x0144A418]\n\t(No symbol) [0x0144A505]\n\t(No symbol) [0x0145508B]\n\tBaseThreadInitThunk [0x770262C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77261B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77261B34+1028]\n"}}
_WD_FindElement ==> No match: HTTP status = 404

-- Subramanian S.

Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

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.
  :)

Link to comment
Share on other sites

I used the Inspect option of Chrome developer tools.  I copied the full Xpath using Copy -> Copy full Xpath option.  When I validate the same using chrome console by using the below code,  its returning the object. 

$x("<copied path>")

Unfortunately I am viewing the rendered page by script.  But when I am accessing through chrome web driver, I am receiving the code used for rendering.  Is there a way to perform the rendering action.

 

Link to comment
Share on other sites

You could try the "Copy Xpath" option instead of the full option. Otherwise, there are the tools I linked above that give you other alternatives.

Quote

Unfortunately I am viewing the rendered page by script.  But when I am accessing through chrome web driver, I am receiving the code used for rendering.  Is there a way to perform the rendering action.

I'm unsure what you are saying here. 🤔 Instead of using _WD_GetSource, you should attempt to capture the rendered HTML via some other method.

Link to comment
Share on other sites

43 minutes ago, Danp2 said:

Instead of using _WD_GetSource, you should attempt to capture the rendered HTML via some other method.

exactly I propose:

https://www.autoitscript.com/wiki/WebDriver#Tools

https://addons.mozilla.org/pl/firefox/addon/save-page-we

https://chrome.google.com/webstore/detail/save-page-we/dhhpefjklgkmgeafimnjhojgjamoafof

very handy tool

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...