Summary: I wanted to know if there was a way to open console in chrome, type window, go to document and search for the getElementById method
Reason: I was searching around and found a lot of the CSS styles for an element(see picture 1 below) and was curious if methods like getElementById were displayed as well
What I tried:
1) I tried looking searching for the getElementById by control + f and searched for "get"
2) Tried seeing if I could get info from mdn: https://developer.mozilla.org/en-US/docs/Web/API/Document/Document
3) Tried reading the link pasted on mdn https://dom.spec.whatwg.org/#interface-nonelementparentnode
Still couldn't find it though :/
element css styles
window.document properties
If I understand you right (directly - how to find 'getElementById' property within global Window object) it is possible to do. You should write in the console Window, open document, then __proto__ (should be the last property of the document object), then __proto__ again, and now you can find getElementById method here. The reason is Window object quite difficult, and uses prototypes to keep all inherit properties and methods: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype
you can get all the elements with a defined id doing right click-> inspect element-> console
and then document.querySelectorAll('*[id]')
but based on picture two, you want to retrieve the class name that starts with "google_"
then do document.querySelectorAll('google_');
or can you please clarify the question? maybe I'm not getting it right
You need to console.dir(document.__proto__.__proto__) as it is in the overall prototype of the document
Related
The functionality I seek is very similar to the default ModelStructurePanel model browser, except that I need to list only a subset of elements, by passing a list of dbIds of the elements I want listed. By clicking on an element on that list, have the view focus on that element.
I figure there might be two ways of achieving this by using the ModelStructurePanel (although I'm open to using something else):
Creating a new instanceTree with only the specified elements, then doing something like viewer.modelstructure.setModel(newInstanceTree)
Overwriting the ModelStructurePanel.shouldInclude method to hide all elements but the specified ones.
I have googled for Viewer code boilerplate that would provide this functionality, but have not found it. Any help is very much appreciated.
There is a basic sample here very close to what you described, and I would go with customizing just one action instead create a new one, seems easier.
Here is the website I am trying to access. I dont want the default tab (Day) though, I want to select the Season tab
https://www.eex.com/en/market-data/power/futures/uk-financial-futures#!/2017/05/23
The link appears to be exactly the same whichever tab is chose making differentiation impossible as far as I can tell.
Any help on this would be much appreciated, using whichever programming method and language is appropriate.
Kind Regards
Barry Walsh
The URL does not change since this is an ajax request, which you can see from MarketDataTableAController's getPageData function. You can read about them here https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started
Ive inspected your html and you seem to be using angular. On further inpection you can see that the tabs have ng-click="setActiveTab(tab)" attribute on them. So whenever user clicks, this function gets executed. It is a matter of using this function with the appropriate tab object to get the content to change. You for example could put setActiveTab(tab) into your controller init method since setActiveTab() calls the forementioned getPageData() function to update the page.
Also the tab you are looking for is page.tabs[5] ($parent.page.tabs[5] if referring from TabController) since this is the tab with the label of season. Pass that to setActiveTab() and it should show you the season instead.
However this might not be a good solution since the tab array ordering might change. Then you would need to loop over all objects in page.tabs and see if tab.label === "Season" and pass that in the function instead or better yet use the $filter service provided by angular which would look more cleaner.
Your code source also seems to be minimized and its not very easy to read.
I'm a bit of trouble instantiating a custom template, and making all the bindings work. My custom element which has to do this is quite similar to polymer/core-list, with a few differences. Like core-list, the parent adds the element invokes my custom element, and adds a template as its content, as seen here.
Unlike core-list, the element adds an id to this template, and creates a few templates which refer to that one, as seen here. Finally, when the time comes, these new templates are used to create a few elements and add them in the dom.
That's all fine and good, and mostly, it works correctly. The model data is used to fill the resulting element correctly, and the default filters work, thanks to the PolymerExpressions used as a bindingDelegate. However, event handlers do not seem to work.
I don't know whether the handler function can't be found in whatever scope is used, or something else is at play here. The only thing I currently know is that the on-tap attribute value is empty when I look at the polymer-icon-button through the web inspector. With a very similar usage using the core-list, the event handler works. The web inspector there shows the polymer expression as the value of the on-tap attribute. And both handlers are defined in the parent element which contains the invokations of core-list and my element, and the templates which are passed to the corresponding contents.
I'm trying to write a test case for Selenium and I'm having a little trouble finding elements. I believe its because my site uses a HTML frame set.
If I open up Firebug, and try to simply select all links:
//a
... I get no results (although the 'menu' frame contains about 15+ links).
If I right-click in the menu frame and choose to "Show Only This Frame", and then select all links in Firebug, I get all 15+ links returned.
This leads me to believe X-Path cannot iterate through elements within a specific frame. Is that true?
When the site is showing all frames, I can select the specific frame:
//frame[#name='menu']
...but trying to drill down to the links starting with that X-Path does not work:
//frame[#name='menu']//a
//frame[#name='menu']###//a <-- Special '###' syntax I read about somewhere to try.
Any help trying to solve this with X-Paths is appreciated. If a CSS selector will work, I could use some pointers there as well. Thanks!
jg
How about you first select the relevant iframe, and then work with the xpaths within that frame.
Sample code in Ruby
iframename = #driver.execute_script("return document.getElementById('IDName').getElementsByTagName('iframe')[0].getAttribute('Attributename')")
#driver.switch_to.frame iframename
# then work with the xpaths
#driver.find_element(:xpath, "//section[#id='SomeId']/div").click
this should help, unless I got the question wrong.
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.