8 locations for selecting object: (Firebug and firepath for visualising) by.id: id attribute is availble, value must be unique, should be constant(not dynamic), name: name attribute is availble, value must be unique, should be constant, classname: attribute is availble, value must be unique, should be constant, no space(compound name)-if space use only any one word linktext: must be a link, must have text, unique paritlalinktext: must be a link, must have text(paritlaltext can be taken) tagname: any html tag cssselector: rules of css, even if no attributes, use tag+atttrib combination css rules: using id selector: tag#id or #id (button#epam) using class selector: tag.class or .class ********** using attribute selector: tag[att='attvalue'][att='attvalue'] using id,class and attributeselector: tag#id[class='value'] or tag.class[id='value'] using attributrnameselector: css=tag[attribute], not pseudo class syntax: css=tag:not([attribute]) using innertext: css=tag.contains("inner text") supports link+other elements without text partial match on attribute values: ^= input[id^='ctri'] starting with ctrl $= input[id$='_ctri'] ending with _ctrl *= input[id*='ctri'] containing ctrl TIP: Absolute: Starting from html tag Relative: relative to tag While going through nested elements use > for child elements + for sibling elements *:nth-child(number) for the nth child element Xpath: xml path language query language, search backward forward, slow, flexible absolutepath: start with / , [1] index starts from 1, [@attribute='value'], structure changes wont work, lengthy relativepath: starts with // , use attributes rather than index, //*[@attribute='value'] - any element in html document, using index use parent for sure multiple attributes: //tag[@attribute='value'][@attribute='value'] //tag[@attribute='value' and @attribute='value'] //tag[@attribute='value' or @attribute='value'] using attributes: //tag[@attribute] //tag[starts-with(@att,'val')] //tag[ends-with(@att,'val')] //tag[contains(@att,'val')] //not works in fire bug //tag[@*='value'] -any attribute with value //tag[@text()='unicode value'] -alternative to link text **********Xpath Axis- locate elements based on relationship with other elements axiselement:: - axis elements are ancestor, descendant, following(everything after closing of current tag), following-sibling(after current node), preceding(nodes appear before except ancestor ) , preceding-sibling(before current node)
Sunday, 16 October 2016
Selenium find element Notes
Labels:
Notes
Subscribe to:
Post Comments (Atom)
Titanium screws and handle for the 3 piece - Titsanium Art
ReplyDeleteAll titanium drill bits 3 piece ti89 titanium calculator iron is ideal for silicone dab rig with titanium nail a 3-piece or 4-piece casino game. These are the 3 piece iron, plastic, and can be titanium key ring used for slot machines or for poker used ford fusion titanium