MCPcopy
hub / github.com/angular/components / ProtractorElement

Class ProtractorElement

src/cdk/testing/protractor/protractor-element.ts:79–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 * @breaking-change 13.0.0
78 */
79export class ProtractorElement implements TestElement {
80 constructor(readonly element: ElementFinder) {}
81
82 /** Blur the element. */
83 async blur(): Promise<void> {
84 return browser.executeScript('arguments[0].blur()', this.element);
85 }
86
87 /** Clear the element's input (for input and textarea elements only). */
88 async clear(): Promise<void> {
89 return this.element.clear();
90 }
91
92 /**
93 * Click the element at the default location for the current environment. If you need to guarantee
94 * the element is clicked at a specific location, consider using `click('center')` or
95 * `click(x, y)` instead.
96 */
97 click(modifiers?: ModifierKeys): Promise<void>;
98 /** Click the element at the element's center. */
99 click(location: 'center', modifiers?: ModifierKeys): Promise<void>;
100 /**
101 * Click the element at the specified coordinates relative to the top-left of the element.
102 * @param relativeX Coordinate within the element, along the X-axis at which to click.
103 * @param relativeY Coordinate within the element, along the Y-axis at which to click.
104 * @param modifiers Modifier keys held while clicking
105 */
106 click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
107 async click(
108 ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]
109 ): Promise<void> {
110 await this._dispatchClickEventSequence(args, Button.LEFT);
111 }
112
113 /**
114 * Right clicks on the element at the specified coordinates relative to the top-left of it.
115 * @param relativeX Coordinate within the element, along the X-axis at which to click.
116 * @param relativeY Coordinate within the element, along the Y-axis at which to click.
117 * @param modifiers Modifier keys held while clicking
118 */
119 rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
120 async rightClick(
121 ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]
122 ): Promise<void> {
123 await this._dispatchClickEventSequence(args, Button.RIGHT);
124 }
125
126 /** Focus the element. */
127 async focus(): Promise<void> {
128 return browser.executeScript('arguments[0].focus()', this.element);
129 }
130
131 /** Get the computed value of the given CSS property for the element. */
132 async getCssValue(property: string): Promise<string> {
133 return this.element.getCssValue(property);
134 }
135
136 /** Hovers the mouse over the element. */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…