Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16942 > unrolled thread
| Started by | gaurangnshah@gmail.com |
|---|---|
| First post | 2012-10-29 01:52 -0700 |
| Last post | 2012-10-29 11:23 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.javascript
how to get the element by text (innerHTML) gaurangnshah@gmail.com - 2012-10-29 01:52 -0700
Re: how to get the element by text (innerHTML) "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-29 11:23 +0200
| From | gaurangnshah@gmail.com |
|---|---|
| Date | 2012-10-29 01:52 -0700 |
| Subject | how to get the element by text (innerHTML) |
| Message-ID | <fdd894aa-524c-475c-b0be-9ee93c7f461a@googlegroups.com> |
Hi guys, I am working as automation engineer. and I have a weird requirement where i need to click on the element by it's innerHTML. Now this innnerHTML may present multiple times in the page but only one would be visible at a time others would be hidden. I have to click on the visible text. Any idea how can i achieve this ?
[toc] | [next] | [standalone]
| From | "Jukka K. Korpela" <jkorpela@cs.tut.fi> |
|---|---|
| Date | 2012-10-29 11:23 +0200 |
| Message-ID | <k6lhv6$ctr$1@dont-email.me> |
| In reply to | #16942 |
2012-10-29 10:52, gaurangnshah@gmail.com wrote: > I am working as automation engineer. and I have a weird requirement where i need to click on the element by it's innerHTML. > > Now this innnerHTML may present multiple times in the page but only one would be visible at a time others would be hidden. I have to click on the visible text. > > Any idea how can i achieve this ? I'm afraid I can't see what the question means. When something is visible on a page, it's the content of the innerHTML property that is displayed, formatted by HTML and CSS rules, you can click on it. What could it possibly mean to click on "innerHTML" in another sense? If you mean *searching* an element by its innerHTML, then you would need to set up a JavaScript function that traverses the document tree and compares the search string with innerHTML properties, or use a library that does such things. But finding out which of several matches is *visible* is a tricky issue, since there are many ways to make elements invisible. If only one technique is used for this (say, style.display set to 'none'), then things get much easier. Please show some example of what would really be going on. -- Yucca, http://www.cs.tut.fi/~jkorpela/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web