1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_
#define CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_
#include <memory>
#include <string>
#include "base/values.h"
#include "chrome/test/chromedriver/basic_types.h"
struct Session;
class Status;
class WebView;
std::string GetElementKey(bool w3c_compliant);
base::Value CreateElement(const std::string& element_id, bool w3c_compliant);
base::Value::Dict CreateValueFrom(const WebPoint& point);
// |root_element_id| could be null when no root element is given.
Status FindElement(int interval_ms,
bool only_one,
const std::string* root_element_id,
Session* session,
WebView* web_view,
const base::Value::Dict& params,
std::unique_ptr<base::Value>* value);
Status FindShadowElement(int interval_ms,
bool only_one,
const std::string* shadow_root_id,
Session* session,
WebView* web_view,
const base::Value::Dict& params,
std::unique_ptr<base::Value>* value);
Status GetActiveElement(Session* session,
WebView* web_view,
std::unique_ptr<base::Value>* value);
Status IsElementFocused(
Session* session,
WebView* web_view,
const std::string& element_id,
bool* is_focused);
Status IsDocumentTypeXml(
Session* session,
WebView* web_view,
bool* is_xml_document);
Status GetElementAttribute(Session* session,
WebView* web_view,
const std::string& element_id,
const std::string& attribute_name,
std::unique_ptr<base::Value>* value);
Status IsElementAttributeEqualToIgnoreCase(
Session* session,
WebView* web_view,
const std::string& element_id,
const std::string& attribute_name,
const std::string& attribute_value,
bool* is_equal);
Status GetElementClickableLocation(
Session* session,
WebView* web_view,
const std::string& element_id,
WebPoint* location);
Status GetElementEffectiveStyle(
Session* session,
WebView* web_view,
const std::string& element_id,
const std::string& property_name,
std::string* property_value);
Status GetElementRegion(
Session* session,
WebView* web_view,
const std::string& element_id,
WebRect* rect);
Status GetElementTagName(
Session* session,
WebView* web_view,
const std::string& element_id,
std::string* name);
Status GetElementSize(
Session* session,
WebView* web_view,
const std::string& element_id,
WebSize* size);
Status IsElementDisplayed(
Session* session,
WebView* web_view,
const std::string& element_id,
bool ignore_opacity,
bool* is_displayed);
Status IsElementEnabled(
Session* session,
WebView* web_view,
const std::string& element_id,
bool* is_enabled);
Status IsOptionElementSelected(
Session* session,
WebView* web_view,
const std::string& element_id,
bool* is_selected);
Status IsOptionElementTogglable(
Session* session,
WebView* web_view,
const std::string& element_id,
bool* is_togglable);
Status SetOptionElementSelected(
Session* session,
WebView* web_view,
const std::string& element_id,
bool selected);
Status ToggleOptionElement(
Session* session,
WebView* web_view,
const std::string& element_id);
// |offset| is an optional offset from the top-left of the first ClientRect
// that is returned by the element's getClientRects() function.
// If |offset| is null, the |location| returned will be the center of the
// ClientRect. If it is non-null, |location| will be offset by the specified
// value.
Status ScrollElementIntoView(
Session* session,
WebView* web_view,
const std::string& element_id,
const WebPoint* offset,
WebPoint* location);
// |element_id| refers to the element which is to be scrolled into view.
// |clickable_element_id| refers to the element needing clickable verification.
// They are usually the same, but can be different. This is useful when an image
// uses map/area. The image is scrolled, but check clickable against the area.
// If |clickable_element_id| is "", no verification will be performed.
Status ScrollElementRegionIntoView(
Session* session,
WebView* web_view,
const std::string& element_id,
const WebRect& region,
bool center,
const std::string& clickable_element_id,
WebPoint* location);
Status GetElementLocationInViewCenter(Session* session,
WebView* web_view,
const std::string& element_id,
WebPoint* location);
Status GetAXNodeByElementId(Session* session,
WebView* web_view,
const std::string& element_id,
std::unique_ptr<base::Value>* axNode);
#endif // CHROME_TEST_CHROMEDRIVER_ELEMENT_UTIL_H_
|