MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / SetActivePointer

Method SetActivePointer

dotnet/src/webdriver/Interactions/Actions.cs:72–85  ·  view source on GitHub ↗

Sets the active pointer device for this Actions class. The kind of pointer device to set as active. The name of the pointer device to set as active. A self-reference to this Actions class. If a device with this name exists but is not a pointer.

(PointerKind kind, string name)

Source from the content-addressed store, hash-verified

70 /// <returns>A self-reference to this Actions class.</returns>
71 /// <exception cref="InvalidOperationException">If a device with this name exists but is not a pointer.</exception>
72 [MemberNotNull(nameof(activePointer))]
73 public Actions SetActivePointer(PointerKind kind, string name)
74 {
75 InputDevice? device = FindDeviceById(name);
76
77 this.activePointer = device switch
78 {
79 null => new PointerInputDevice(kind, name),
80 PointerInputDevice pointerDevice => pointerDevice,
81 _ => throw new InvalidOperationException($"Device under the name \"{name}\" is not a pointer. Actual input type: {device.DeviceKind}"),
82 };
83
84 return this;
85 }
86
87 /// <summary>
88 /// Sets the active keyboard device for this Actions class.

Calls

no outgoing calls