Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/webdriver-interactions/interactions.h
2867 views
1
/*
2
Licensed to the Software Freedom Conservancy (SFC) under one
3
or more contributor license agreements. See the NOTICE file
4
distributed with this work for additional information
5
regarding copyright ownership. The SFC licenses this file
6
to you under the Apache License, Version 2.0 (the "License");
7
you may not use this file except in compliance with the License.
8
You may obtain a copy of the License at
9
10
http://www.apache.org/licenses/LICENSE-2.0
11
12
Unless required by applicable law or agreed to in writing, software
13
distributed under the License is distributed on an "AS IS" BASIS,
14
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
See the License for the specific language governing permissions and
16
limitations under the License.
17
*/
18
19
#ifndef interactions_h
20
#define interactions_h
21
22
#ifdef _MSC_VER
23
#include "stdafx.h"
24
#include "interaction_utils.h"
25
#endif
26
27
#include <wchar.h>
28
29
#ifdef _MSC_VER
30
#define EXPORT __declspec(dllexport)
31
#define WD_RESULT LRESULT
32
#else
33
#define EXPORT
34
#define WD_RESULT int
35
#endif
36
37
#define WINDOW_HANDLE void*
38
39
// definitions for mouse buttons
40
// NOTE: These values correspond to GDK mouse button values.
41
// If these values are changed, native events for linux *will* be broken
42
// *unless* interactions_linux_mouse.cpp is updated.
43
#define MOUSEBUTTON_LEFT (1)
44
#define MOUSEBUTTON_MIDDLE (2)
45
#define MOUSEBUTTON_RIGHT (3)
46
47
#define WD_CLIENT_LEFT_MOUSE_BUTTON 0
48
#define WD_CLIENT_MIDDLE_MOUSE_BUTTON 1
49
#define WD_CLIENT_RIGHT_MOUSE_BUTTON 2
50
51
#ifdef __cplusplus
52
extern "C" {
53
#endif
54
55
// Keyboard interactions
56
EXPORT void sendKeys(WINDOW_HANDLE windowHandle, const wchar_t* value, int timePerKey);
57
EXPORT void releaseModifierKeys(WINDOW_HANDLE windowHandle, int timePerKey);
58
EXPORT bool pending_input_events();
59
EXPORT void stopPersistentEventFiring();
60
EXPORT void setEnablePersistentHover(bool enablePersistentHover);
61
62
// Mouse interactions
63
EXPORT WD_RESULT clickAt(WINDOW_HANDLE directInputTo, long x, long y, long button);
64
EXPORT WD_RESULT doubleClickAt(WINDOW_HANDLE directInputTo, long x, long y);
65
EXPORT WD_RESULT mouseDownAt(WINDOW_HANDLE directInputTo, long x, long y, long button);
66
EXPORT WD_RESULT mouseUpAt(WINDOW_HANDLE directInputTo, long x, long y, long button);
67
EXPORT WD_RESULT mouseMoveTo(WINDOW_HANDLE directInputTo, long duration, long fromX, long fromY, long toX, long toY);
68
69
#ifdef __cplusplus
70
}
71
#endif
72
#endif
73
74