I'm using Delphi 2009 and I want to find index of HTML table which contains given element.
So, in the application, which I created, I use web browser to see the web page. I want to select element from this page and want to get Index of table which contains this element.
If someone can do it, please help me
Using the browser's DOM interfaces, locate the IHTMLElement interface of the desired HTML element as needed, then use its parentElement property to get its parent element, repeating as needed, until you find an element that supports the IHTMLTableCell interface. Its cellIndex property will tell you the index of the cell within its row. Keep iterating the parentElement chain until you find an element that supports the IHTMLTableRow interface. Its rowIndex property will tell you the index of the row within its table. If you need to access the table itself, keep iterating the parentElement chain until you find an element that supports the IHTMLTable interface.
Related
I am new to Blue Prism and Web scraping. I want to scrape a list of items under a header. The header won't change, but the items in the list will.
Example:
Member Listing
Charles Schwab
TD Ameritrade
List changes
Member Listing
Well Fargo
TD Ameritrade
So how do I ensure the attributes in the Application Modeller for the list will always be able to scrape the changing items in the list?
I note some attributes like
tag name = UI
path=/HTML/BODY(1)/SGX-HEADER(1)/HTML/BODY(1)/DIV(1)/MAIN(1)/DIV(1)/ARTICLE(1)/TEMPLATE-BASE(1)/DIV(1)/DIV(1)/SECTION(1)/DIV(1)/SGX-WIDGETS-WRAPPER(1)/WIDGET-RICH-TEXT(5)/UL(1)
What do these attributes mean? Thank you
You can create the attribute to be dynamic and verify it exists before reading it from the application. Once your app modeller is set up it will look something like
path=/HTML/BODY(1)/SGX-HEADER(1)/HTML/BODY(1)/DIV(1)/MAIN(1)/DIV(1)/ARTICLE(1)/TEMPLATE-BASE(1)/DIV(1)/DIV(1)/SECTION(1)/DIV(1)/SGX-WIDGETS-WRAPPER(1)/WIDGET-RICH-TEXT(5)/UL(1)
with this field being set to dynamic. At run time you have a flow that looks like the below:
this is what the flow would look like, check it exists then make space in a collection and read the value at the element path that exists. the wait stage looks like this:
so the flow Is straight forward enough, dynamic variable to track the element existing, once it exists confirmed by wait stage then read the contents at that path value and repeat until there are no more elements that exist and output the collection as a result.
I have the below flow, and I would like the userGroup to be a loop as well according to data that's coming from another database lookup, Can you point me to the best way to approach this?
Your help is appreciated.
You cannot have nested loops in tXMLMap. Another way to achieve this is to build your XML by using the tWriteXMLField component where you can use the concept of Group and Loop Elements. In your example, your group element will be User whereas the loop element will be UserGroup. This allows the grouping (first loop) to be based on the User Tag, and the User Group tag will be your looping element (second loop) inside it. I have attached an image of an a sample:
Hope this helps.
I am developing a Polymer component that uses <template is="dom-repeat" items="rows"> to populate a table, and need to debug what is happening in some rows. In Chrome developer tools I can select the component in the DOM and inspect all of the rows array using $0.rows. But how do I inspect the data for an individual row? If I select one of the generated row elements, is there any connection between $0 and the array item used to generate the row?
As per the docs, you can use the modelForElement(el), itemForElement(el) and keyForElement(el) functions.
this.$.repeater.modelForElement($0)
It can be used on any node, not only the top level element of the repeated template. Getting the this.$.repeater can be tricky from the Dev tools though. The above would assume a breakpoint inside your element.
As a second option you can take advantage of the fact that each top level element stamped by the repeater gets an additional property called _templateInstance. It will contain all the data you need. Remember however that this is internal implementation detail and could change as Polymer evolves. So debug but don't use that in your code.
I was busy making a JavaScript code that allows me to make GUI page elements to have custom context menus, when I thought about checking to see if an element exists in order to make a context menu for it.
function element_exists(el){
var tagName=el.tagName;
var exists=0;
for(var a=0;a<document.getElementsByTagName(tagName).length;a++){
if(document.getElementsByTagName(tagName)[a]==el){
exists=1;
}
}
return exists;
}
In this code, I pass a reference to a DOM element object (which is stored from earlier).
Let's say that it was stored, but since then I removed the element itself from the document.
I'm using Chrome Canary, and even if I edit the page through the console and make a new element with the exact same tag name and ID, it returns false. Would it return true if it had the same innerText and innerHTML?
If not, is this a standard in all web browsers (old and new)?
Just curious because I could eliminate some unnecessary code if they're all unique.
I'm pretty sure the answer is no; each element is unique, regardless of whether they have similar values (including "id").
This might provide you some insight into how element garbage collection works in Chrome. I'm not sure how the other browsers respond though.
http://www.html5rocks.com/en/tutorials/memory/effectivemanagement/
It outlines some tools that might be useful to test your theory.
Anyone can explain briefly about the [Inspectable] metadata tag. I read and could not understand in live docs.
Please help me when we are going to use the [Inspectable] metadata tag?
Thanks,
ravi
The tag is used with properties to provide code hints for that property and to specify the possible list of values that property can take while using it in mxml. Unlike [Bindable] metadata, this tag doesn't have much effect on the working of the code (other than specifying a default value) - this is used mainly to give directions to Flex Builder regarding how to deal with a particular property.
[Inspectable] metadata tag
Defines an attribute exposed to component users in the attribute hints and Tag inspector of Flex Builder. Also limits allowable values of the property.
For example, the verticalScrollPolicy property of the mx.core.Container class has the following [Inspectable] tag with it.
[Inspectable(category="General", enumeration="off,on,auto", defaultValue="auto")]
public function get verticalScrollPolicy():String
{
return _verticalScrollPolicy;
}
This tells Flex Builder that this property should appear in the 'General' tab (it is 'Common' in my FB) of the Flex Builder's property inspector (open an mxml file, go to the Windows menu and select Flex Properties to open the property inspector - towards the upper side of inspector tab, near its title, you will find buttons to switch to standard view, category view, and alphabetical view). This property can take one of the three values off, on, auto and if none is specified it takes auto as its default value.
I've never used this tag and I believe you too won't be using it much unless you are writing a Flex API to be used by a bigger audience than your colleagues (or if you are a perfectionist).
This tag is useful for when you write your own custom components. While it does not interact with the actual code you write (unlike the [Bindable] tag, mentioned above), it does give the Flexbuilder environment a way of allowing the user to set properties of your component using the UI Designer.
Therefore, the tag is useful if you want to:
Write components that are to be used by other people (make only the publicly accessible properties Inspect'able)
You've written a custom component that is used multiple times in your UI (maybe an extended slider). You then write some Inspect'able getter/setter methods as the public API to your component, and then implement these getter/setter methods to do data validation and implement the internal logic of your component.
You can find more information and examples here. Some good info on writing custom components (using the code behind methodology, which I prefer) can be found here.
Note: When creating exposed properties using [Inspectable], they don't seem to show up in the Flexbuilder Flex-Properties panel (not in Standard view anyway, use Category view or Alphabetical view, instead)
Note: You can find an alternative method of adding public properties to your custom components using MXLM, like this.