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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import shared_page_state
from telemetry.page import page as page_module
class KeyMobileSitesPage(page_module.Page):
def __init__(self, url, page_set, name='', labels=None):
super(KeyMobileSitesPage, self).__init__(
url=url, page_set=page_set, name=name,
shared_page_state_class=shared_page_state.SharedMobilePageState,
credentials_path='data/credentials.json', labels=labels)
self.archive_data_file = 'data/key_mobile_sites.json'
class CapitolVolkswagenPage(KeyMobileSitesPage):
""" Why: Typical mobile business site """
def __init__(self, page_set):
super(CapitolVolkswagenPage, self).__init__(
url=('http://iphone.capitolvolkswagen.com/index.htm'
'#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'),
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(CapitolVolkswagenPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForElement(text='Next 35')
action_runner.WaitForJavaScriptCondition(
'document.body.scrollHeight > 2560')
class TheVergeArticlePage(KeyMobileSitesPage):
""" Why: Top tech blog """
def __init__(self, page_set):
super(TheVergeArticlePage, self).__init__(
# pylint: disable=C0301
url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad-mini-ad-ballsy',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(TheVergeArticlePage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'window.Chorus !== undefined &&'
'window.Chorus.Comments !== undefined &&'
'window.Chorus.Comments.Json !== undefined &&'
'(window.Chorus.Comments.loaded ||'
' window.Chorus.Comments.Json.load_comments())')
class CnnArticlePage(KeyMobileSitesPage):
""" Why: Top news site """
def __init__(self, page_set):
super(CnnArticlePage, self).__init__(
# pylint: disable=C0301
url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.html',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(CnnArticlePage, self).RunNavigateSteps(action_runner)
action_runner.Wait(8)
class FacebookPage(KeyMobileSitesPage):
""" Why: #1 (Alexa global) """
def __init__(self, page_set):
super(FacebookPage, self).__init__(
url='https://facebook.com/barackobama',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(FacebookPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById("u_0_c") !== null &&'
'document.body.scrollHeight > window.innerHeight')
class YoutubeMobilePage(KeyMobileSitesPage):
""" Why: #3 (Alexa global) """
def __init__(self, page_set):
super(YoutubeMobilePage, self).__init__(
url='http://m.youtube.com/watch?v=9hBpF_Zj4OA',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(YoutubeMobilePage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById("paginatortarget") !== null')
class LinkedInPage(KeyMobileSitesPage):
""" Why: #12 (Alexa global),Public profile """
def __init__(self, page_set):
super(LinkedInPage, self).__init__(
url='https://www.linkedin.com/in/linustorvalds',
page_set=page_set,
name='LinkedIn')
def RunNavigateSteps(self, action_runner):
super(LinkedInPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById("profile-view-scroller") !== null')
class YahooAnswersPage(KeyMobileSitesPage):
""" Why: #1 Alexa reference """
def __init__(self, page_set):
super(YahooAnswersPage, self).__init__(
# pylint: disable=C0301
url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(YahooAnswersPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForElement(text='Other Answers (1 - 20 of 149)')
action_runner.ClickElement(text='Other Answers (1 - 20 of 149)')
class GmailPage(KeyMobileSitesPage):
""" Why: productivity, top google properties """
def __init__(self, page_set):
super(GmailPage, self).__init__(
url='https://mail.google.com/mail/',
page_set=page_set)
self.credentials = 'google'
def RunNavigateSteps(self, action_runner):
super(GmailPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById("og_user_warning") !== null')
action_runner.WaitForJavaScriptCondition(
'document.getElementById("og_user_warning") === null')
class GroupClonedPage(KeyMobileSitesPage):
""" Why: crbug.com/172906 """
def __init__(self, page_set):
super(GroupClonedPage, self).__init__(
url='http://groupcloned.com',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(GroupClonedPage, self).RunNavigateSteps(action_runner)
action_runner.Wait(5)
action_runner.WaitForJavaScriptCondition('''
document.getElementById("element-19") !== null &&
document.getElementById("element-19").contentDocument
.getElementById("element-22") !== null &&
document.getElementById("element-19").contentDocument
.getElementsByClassName(
"container list-item gc-list-item stretched").length !== 0''')
class GroupClonedListImagesPage(KeyMobileSitesPage):
""" Why: crbug.com/172906 """
def __init__(self, page_set):
super(GroupClonedListImagesPage, self).__init__(
url='http://groupcloned.com/test/list-images-variable/index.html',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(GroupClonedListImagesPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById("element-5") !== null')
class GoogleNewsMobilePage(KeyMobileSitesPage):
""" Why: Google News: accelerated scrolling version """
def __init__(self, page_set):
super(GoogleNewsMobilePage, self).__init__(
url='http://mobile-news.sandbox.google.com/news/pt1',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(GoogleNewsMobilePage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'typeof NEWS_telemetryReady !== "undefined" && '
'NEWS_telemetryReady == true')
class GoogleNewsMobile2Page(KeyMobileSitesPage):
"""
Why: Google News: this iOS version is slower than accelerated scrolling
"""
def __init__(self, page_set):
super(GoogleNewsMobile2Page, self).__init__(
url='http://mobile-news.sandbox.google.com/news/pt0',
page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(GoogleNewsMobile2Page, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'document.getElementById(":h") != null')
action_runner.Wait(1)
class AmazonNicolasCagePage(KeyMobileSitesPage):
"""
Why: #1 world commerce website by visits; #3 commerce in the US by time spent
"""
def __init__(self, page_set):
super(AmazonNicolasCagePage, self).__init__(
url='http://www.amazon.com/gp/aw/s/ref=is_box_?k=nicolas+cage',
page_set=page_set)
|