File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed
devtools_request_interception_test
rb/spec/integration/selenium/webdriver Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 1+ <!doctype html>
2+
3+ < html lang ="en ">
4+ < head >
5+ < title > DevTools Request Interception Test</ title >
6+ < script language ="javascript " type ="text/javascript " src ="devtools_request_interception_test/one.js "> </ script >
7+ </ head >
8+
9+ < body >
10+ < div id ="result "> </ div >
11+ < button onClick ="printScriptName() ">
12+ Click me to print script name
13+ </ button >
14+ </ body >
15+ </ html >
Original file line number Diff line number Diff line change 1+ function printScriptName ( ) {
2+ document . getElementById ( 'result' ) . innerHTML = 'one' ;
3+ }
Original file line number Diff line number Diff line change 1+ function printScriptName ( ) {
2+ document . getElementById ( 'result' ) . innerHTML = 'two' ;
3+ }
Original file line number Diff line number Diff line change @@ -167,14 +167,15 @@ module WebDriver
167167 it 'changes requests' do
168168 driver . intercept do |request , &continue |
169169 uri = URI ( request . url )
170- if uri . path . match? ( %r{/html5/.* \. jpg} )
171- uri . path = '/beach.jpg '
170+ if uri . path . end_with? ( 'one.js' )
171+ uri . path = '/devtools_request_interception_test/two.js '
172172 request . url = uri . to_s
173173 end
174174 continue . call ( request )
175175 end
176- driver . navigate . to url_for ( 'html5Page.html' )
177- expect ( driver . find_elements ( tag_name : 'img' ) . map ( &:size ) . uniq ) . to eq ( [ Dimension . new ( 640 , 480 ) ] )
176+ driver . navigate . to url_for ( 'devToolsRequestInterceptionTest.html' )
177+ driver . find_element ( tag_name : 'button' ) . click
178+ expect ( driver . find_element ( id : 'result' ) . text ) . to eq ( 'two' )
178179 end
179180
180181 it 'continues responses' do
You can’t perform that action at this time.
0 commit comments