How to use afterWindowChangeSize method of io.appium.java_client.events.api.general.WindowEventListener class

Best io.appium code snippet using io.appium.java_client.events.api.general.WindowEventListener.afterWindowChangeSize

Run io.appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

DefaultListener.java

Source: DefaultListener.java Github

copy
1/*
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * See the NOTICE file distributed with this work for additional
5 * information regarding copyright ownership.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package io.appium.java_client.events;
18
19import io.appium.java_client.events.api.Listener;
20import io.appium.java_client.events.api.general.AlertEventListener;
21import io.appium.java_client.events.api.general.AppiumWebDriverEventListener;
22import io.appium.java_client.events.api.general.ElementEventListener;
23import io.appium.java_client.events.api.general.JavaScriptEventListener;
24import io.appium.java_client.events.api.general.ListensToException;
25import io.appium.java_client.events.api.general.NavigationEventListener;
26import io.appium.java_client.events.api.general.SearchingEventListener;
27import io.appium.java_client.events.api.general.WindowEventListener;
28import io.appium.java_client.events.api.mobile.ContextEventListener;
29import io.appium.java_client.events.api.mobile.RotationEventListener;
30import org.openqa.selenium.Alert;
31import org.openqa.selenium.By;
32import org.openqa.selenium.Dimension;
33import org.openqa.selenium.Point;
34import org.openqa.selenium.ScreenOrientation;
35import org.openqa.selenium.WebDriver;
36import org.openqa.selenium.WebElement;
37import org.openqa.selenium.security.Credentials;
38import org.openqa.selenium.support.events.WebDriverEventListener;
39
40import java.lang.reflect.Proxy;
41import java.util.ArrayList;
42import java.util.Collection;
43import java.util.List;
44
45class DefaultListener
46    implements Listener, AppiumWebDriverEventListener, ListensToException, SearchingEventListener,
47    NavigationEventListener, JavaScriptEventListener, ElementEventListener, AlertEventListener,
48    WindowEventListener, ContextEventListener, RotationEventListener {
49
50    private final List<Listener> listeners = new ArrayList<>();
51
52    private Object dispatcher = Proxy.newProxyInstance(Listener.class.getClassLoader(),
53        new Class[] {AlertEventListener.class, ContextEventListener.class,
54            ElementEventListener.class, JavaScriptEventListener.class, ListensToException.class,
55            NavigationEventListener.class, RotationEventListener.class,
56            SearchingEventListener.class, WindowEventListener.class, WebDriverEventListener.class},
57        new ListenerInvocationHandler(listeners));
58
59    @Override public void beforeNavigateTo(String url, WebDriver driver) {
60        ((NavigationEventListener) dispatcher).beforeNavigateTo(url, driver);
61    }
62
63    @Override public void afterNavigateTo(String url, WebDriver driver) {
64        ((NavigationEventListener) dispatcher).afterNavigateTo(url, driver);
65    }
66
67    @Override public void beforeNavigateBack(WebDriver driver) {
68        ((NavigationEventListener) dispatcher).beforeNavigateBack(driver);
69    }
70
71    @Override public void afterNavigateBack(WebDriver driver) {
72        ((NavigationEventListener) dispatcher).afterNavigateBack(driver);
73    }
74
75    @Override public void beforeNavigateForward(WebDriver driver) {
76        ((NavigationEventListener) dispatcher).beforeNavigateForward(driver);
77    }
78
79    @Override public void afterNavigateForward(WebDriver driver) {
80        ((NavigationEventListener) dispatcher).afterNavigateForward(driver);
81    }
82
83    @Override public void beforeNavigateRefresh(WebDriver driver) {
84        ((NavigationEventListener) dispatcher).beforeNavigateRefresh(driver);
85    }
86
87    @Override public void afterNavigateRefresh(WebDriver driver) {
88        ((NavigationEventListener) dispatcher).afterNavigateRefresh(driver);
89    }
90
91    @Override public void beforeFindBy(By by, WebElement element, WebDriver driver) {
92        ((SearchingEventListener) dispatcher).beforeFindBy(by, element, driver);
93    }
94
95    @Override public void afterFindBy(By by, WebElement element, WebDriver driver) {
96        ((SearchingEventListener) dispatcher).afterFindBy(by, element, driver);
97    }
98
99    @Override public void beforeClickOn(WebElement element, WebDriver driver) {
100        ((ElementEventListener) dispatcher).beforeClickOn(element, driver);
101    }
102
103    @Override public void afterClickOn(WebElement element, WebDriver driver) {
104        ((ElementEventListener) dispatcher).afterClickOn(element, driver);
105    }
106
107    @Override public void beforeChangeValueOf(WebElement element, WebDriver driver) {
108        ((ElementEventListener) dispatcher).beforeChangeValueOf(element, driver);
109    }
110
111    @Override public void beforeChangeValueOf(WebElement element, WebDriver driver,
112        CharSequence[] keysToSend) {
113        ((ElementEventListener) dispatcher).beforeChangeValueOf(element, driver, keysToSend);
114    }
115
116    @Override public void afterChangeValueOf(WebElement element, WebDriver driver) {
117        ((ElementEventListener) dispatcher).afterChangeValueOf(element, driver);
118    }
119
120    @Override public void afterChangeValueOf(WebElement element, WebDriver driver,
121        CharSequence[] keysToSend) {
122        ((ElementEventListener) dispatcher).afterChangeValueOf(element, driver, keysToSend);
123    }
124
125    @Override public void beforeScript(String script, WebDriver driver) {
126        ((JavaScriptEventListener) dispatcher).beforeScript(script, driver);
127    }
128
129    @Override public void afterScript(String script, WebDriver driver) {
130        ((JavaScriptEventListener) dispatcher).afterScript(script, driver);
131    }
132
133    @Override public void onException(Throwable throwable, WebDriver driver) {
134        ((ListensToException) dispatcher).onException(throwable, driver);
135    }
136
137    public void add(Collection<Listener> listeners) {
138        this.listeners.addAll(listeners);
139    }
140
141    @Override public void beforeAlertAccept(WebDriver driver, Alert alert) {
142        ((AlertEventListener) dispatcher).beforeAlertAccept(driver, alert);
143    }
144
145    @Override
146    public void beforeAlertAccept(WebDriver driver) {
147        ((WebDriverEventListener) dispatcher).beforeAlertAccept(driver);
148    }
149
150    @Override public void afterAlertAccept(WebDriver driver, Alert alert) {
151        ((AlertEventListener) dispatcher).afterAlertAccept(driver, alert);
152    }
153
154    @Override
155    public void afterAlertAccept(WebDriver driver) {
156        ((WebDriverEventListener) dispatcher).afterAlertAccept(driver);
157    }
158
159    @Override public void afterAlertDismiss(WebDriver driver, Alert alert) {
160        ((AlertEventListener) dispatcher).afterAlertDismiss(driver, alert);
161    }
162
163    @Override
164    public void afterAlertDismiss(WebDriver driver) {
165        ((WebDriverEventListener) dispatcher).afterAlertDismiss(driver);
166    }
167
168    @Override public void beforeAlertDismiss(WebDriver driver, Alert alert) {
169        ((AlertEventListener) dispatcher).beforeAlertDismiss(driver, alert);
170    }
171
172    @Override
173    public void beforeAlertDismiss(WebDriver driver) {
174        ((WebDriverEventListener) dispatcher).beforeAlertDismiss(driver);
175    }
176
177    @Override public void beforeAlertSendKeys(WebDriver driver, Alert alert, String keys) {
178        ((AlertEventListener) dispatcher).beforeAlertSendKeys(driver, alert, keys);
179    }
180
181    @Override public void afterAlertSendKeys(WebDriver driver, Alert alert, String keys) {
182        ((AlertEventListener) dispatcher).afterAlertSendKeys(driver, alert, keys);
183    }
184
185    @Override
186    public void beforeAuthentication(WebDriver driver, Alert alert, Credentials credentials) {
187        ((AlertEventListener) dispatcher).beforeAuthentication(driver, alert, credentials);
188    }
189
190    @Override
191    public void afterAuthentication(WebDriver driver, Alert alert, Credentials credentials) {
192        ((AlertEventListener) dispatcher).afterAuthentication(driver, alert, credentials);
193    }
194
195    @Override public void beforeWindowChangeSize(WebDriver driver, WebDriver.Window window,
196        Dimension targetSize) {
197        ((WindowEventListener) dispatcher).beforeWindowChangeSize(driver, window, targetSize);
198    }
199
200    @Override public void afterWindowChangeSize(WebDriver driver, WebDriver.Window window,
201        Dimension targetSize) {
202        ((WindowEventListener) dispatcher).afterWindowChangeSize(driver, window, targetSize);
203    }
204
205    @Override
206    public void beforeWindowIsMoved(WebDriver driver, WebDriver.Window window, Point targetPoint) {
207        ((WindowEventListener) dispatcher).beforeWindowIsMoved(driver, window, targetPoint);
208    }
209
210    @Override
211    public void afterWindowIsMoved(WebDriver driver, WebDriver.Window window, Point targetPoint) {
212        ((WindowEventListener) dispatcher).afterWindowIsMoved(driver, window, targetPoint);
213    }
214
215    @Override public void beforeWindowIsMaximized(WebDriver driver, WebDriver.Window window) {
216        ((WindowEventListener) dispatcher).beforeWindowIsMaximized(driver, window);
217    }
218
219    @Override public void afterWindowIsMaximized(WebDriver driver, WebDriver.Window window) {
220        ((WindowEventListener) dispatcher).afterWindowIsMaximized(driver, window);
221    }
222
223    @Override public void beforeSwitchingToContext(WebDriver driver, String context) {
224        ((ContextEventListener) dispatcher).beforeSwitchingToContext(driver, context);
225    }
226
227    @Override public void afterSwitchingToContext(WebDriver driver, String context) {
228        ((ContextEventListener) dispatcher).afterSwitchingToContext(driver, context);
229    }
230
231    @Override public void beforeRotation(WebDriver driver, ScreenOrientation orientation) {
232        ((RotationEventListener) dispatcher).beforeRotation(driver, orientation);
233    }
234
235    @Override public void afterRotation(WebDriver driver, ScreenOrientation orientation) {
236        ((RotationEventListener) dispatcher).afterRotation(driver, orientation);
237    }
238}
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger afterWindowChangeSize code on LambdaTest Cloud Grid

Execute automation tests with afterWindowChangeSize on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)