Launch Google Chrome and access it's DOM elements

Class library usage, coding and language questions.
Posts: 1
Joined: Sun Aug 11, 2013 2:04 pm

Launch Google Chrome and access it's DOM elements

Post by johndoe777 » Sun Aug 11, 2013 2:11 pm


I'm trying to automate a webpage using code.
I've tried to use "Record & Play", but it didn't work well for me, because this website is using different ids for each session.

This is the code I'm trying to imitate:
pseudo code:

Code: Select all

var document = OpenBrowser("", "chrome");
var elements = document.getElementsByTagName("input");
in Ranorex, I've used the following:

Code: Select all

int procssID = Host.Local.OpenBrowser("", "chrome", "", false, false);
But now, I dont know how to get access to the DOM elements of the process of chrome.
When I tried to use:

Code: Select all

I've received objects of "IE", and _NOT_ of the "chrome.exe" process I have launched.

Is there any way at all to do it ?
Thanks for any help.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12174
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Launch Google Chrome and access it's DOM elements

Post by Support Team » Tue Aug 13, 2013 4:42 pm


Some webpages uses 'Dynamic IDs' which make it difficult for Test Automation.
We have posted a blog that describes this issue and presents a solution: ... ynamic-ids

It looks like that the DOM object of Chrome is not fully loaded when you try to access it.
Please try to add a Validate.Exists() before:

Code: Select all

Alternatively, you could use WaitForDocumentLoaded():

Code: Select all

WebDocument webDoc = @"/dom[@domain='']";
Markus (T)