Ask a Question

How to get Objects using getElementsByClassName

lokithorshield
Contributor

How to get Objects using getElementsByClassName

Hello, 

var some_var = Sys.Browser("*").Page("*").contentDocument.getElementsByClassName("xxx");
var someoTher_Var = some_var.item(1)
Log.Message(some_var.FullName);

 

I am able to see get element by class name as 8 objects - length 8?. But how to access the object? convert to Array using 'toArray' not working. How do I actually get the first object

 

Thanks,

Mahesh

2 REPLIES 2
TanyaYatskovska
SmartBear Alumni (Retired)

Hi Lokithorshield,

 

I recommend that you use CSS selectors to get objects based on CSS. Please read the Finding Web Objects Using CSS Selectors article for more information - http://smartbear.com/viewarticle/70080/

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Hi Tanya,

I guess this is not a CSS element. It comes under SVG node, so the HTML nodes below does not get recognized. Either Content document find works or switching the Object model - Tree to DOM works. So instead of dynamically changing the model, am using the above. CSS/Xpath etc is not working.

 

Thanks,

Mahesh

cancel
Showing results for 
Search instead for 
Did you mean: