1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_
6 #define CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/test/chromedriver/basic_types.h"
14 class DictionaryValue
;
23 base::DictionaryValue
* CreateElement(const std::string
& element_id
);
25 base::Value
* CreateValueFrom(const WebPoint
& point
);
27 // |root_element_id| could be null when no root element is given.
31 const std::string
* root_element_id
,
34 const base::DictionaryValue
& params
,
35 scoped_ptr
<base::Value
>* value
);
37 Status
GetActiveElement(
40 scoped_ptr
<base::Value
>* value
);
42 Status
IsElementFocused(
45 const std::string
& element_id
,
48 Status
GetElementAttribute(
51 const std::string
& element_id
,
52 const std::string
& attribute_name
,
53 scoped_ptr
<base::Value
>* value
);
55 Status
IsElementAttributeEqualToIgnoreCase(
58 const std::string
& element_id
,
59 const std::string
& attribute_name
,
60 const std::string
& attribute_value
,
63 Status
GetElementClickableLocation(
66 const std::string
& element_id
,
69 Status
GetElementEffectiveStyle(
72 const std::string
& element_id
,
73 const std::string
& property_name
,
74 std::string
* property_value
);
76 Status
GetElementRegion(
79 const std::string
& element_id
,
82 Status
GetElementTagName(
85 const std::string
& element_id
,
88 Status
GetElementSize(
91 const std::string
& element_id
,
94 Status
IsElementDisplayed(
97 const std::string
& element_id
,
101 Status
IsElementEnabled(
104 const std::string
& element_id
,
107 Status
IsOptionElementSelected(
110 const std::string
& element_id
,
113 Status
IsOptionElementTogglable(
116 const std::string
& element_id
,
119 Status
SetOptionElementSelected(
122 const std::string
& element_id
,
125 Status
ToggleOptionElement(
128 const std::string
& element_id
);
130 // |offset| is an optional offset from the top-left of the first ClientRect
131 // that is returned by the element's getClientRects() function.
132 // If |offset| is null, the |location| returned will be the center of the
133 // ClientRect. If it is non-null, |location| will be offset by the specified
135 Status
ScrollElementIntoView(
138 const std::string
& element_id
,
139 const WebPoint
* offset
,
142 // |element_id| refers to the element which is to be scrolled into view.
143 // |clickable_element_id| refers to the element needing clickable verification.
144 // They are usually the same, but can be different. This is useful when an image
145 // uses map/area. The image is scrolled, but check clickable against the area.
146 // If |clickable_element_id| is "", no verification will be performed.
147 Status
ScrollElementRegionIntoView(
150 const std::string
& element_id
,
151 const WebRect
& region
,
153 const std::string
& clickable_element_id
,
156 #endif // CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_