Skip to content

Commit 45e733e

Browse files
committed
deprecate submit command
1 parent bd028fa commit 45e733e

File tree

4 files changed

+22
-137
lines changed

4 files changed

+22
-137
lines changed

packages/selenium-ide/src/__test__/content/record-api.spec.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ describe('record-api', () => {
112112
).toBeUndefined()
113113
})
114114

115-
it('keydown on input records submit (on Firefox)', () => {
116-
isFirefox.mockReturnValue(true)
117-
fireEvent.keyDown(inputElement, enterKey)
118-
fireEvent.keyUp(inputElement, enterKey)
119-
expect(recordApi.record.mock.calls[1][0]).toEqual('submit')
120-
})
121-
122115
it('click on button without type=submit records click', () => {
123116
const button = window.document.querySelector('button')
124117
fireEvent.click(button)

packages/selenium-ide/src/__test__/content/record.spec.js

Lines changed: 0 additions & 90 deletions
This file was deleted.

packages/selenium-ide/src/content/record.js

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ export const locatorBuilders = new LocatorBuilders(window)
2828

2929
attach(record)
3030

31-
export function _isValidForm(tagName, target) {
32-
return !!(
33-
tagName == 'form' &&
34-
(target.hasAttribute('id') || target.hasAttribute('name')) &&
35-
!target.hasAttribute('onsubmit') &&
36-
isFirefox()
37-
)
38-
}
39-
40-
export function _recordFormAction(target) {
41-
if (target.hasAttribute('id'))
42-
record('submit', [['id=' + target.id, 'id']], '')
43-
else if (target.hasAttribute('name'))
44-
record('submit', [['name=' + target.name, 'name']], '')
45-
}
46-
4731
Recorder.inputTypes = [
4832
'text',
4933
'password',
@@ -90,14 +74,11 @@ Recorder.addEventHandler('type', 'change', function(event) {
9074
formChk = tempTarget.tagName.toLowerCase()
9175
}
9276

93-
if (_isValidForm(formChk, tempTarget)) {
94-
_recordFormAction(tempTarget)
95-
} else
96-
record(
97-
'sendKeys',
98-
locatorBuilders.buildAll(this.recordingState.enterTarget),
99-
'${KEY_ENTER}'
100-
)
77+
record(
78+
'sendKeys',
79+
locatorBuilders.buildAll(this.recordingState.enterTarget),
80+
'${KEY_ENTER}'
81+
)
10182
this.recordingState.enterTarget = null
10283
}
10384
// END
@@ -190,14 +171,11 @@ Recorder.addEventHandler(
190171
tempTarget = tempTarget.parentElement
191172
formChk = tempTarget.tagName.toLowerCase()
192173
}
193-
if (_isValidForm(formChk, tempTarget)) {
194-
_recordFormAction(tempTarget)
195-
} else
196-
record(
197-
'sendKeys',
198-
locatorBuilders.buildAll(this.recordingState.enterTarget),
199-
'${KEY_ENTER}'
200-
)
174+
record(
175+
'sendKeys',
176+
locatorBuilders.buildAll(this.recordingState.enterTarget),
177+
'${KEY_ENTER}'
178+
)
201179
this.recordingState.enterTarget = null
202180
}
203181
if (
@@ -225,14 +203,11 @@ Recorder.addEventHandler(
225203
tempTarget = tempTarget.parentElement
226204
formChk = tempTarget.tagName.toLowerCase()
227205
}
228-
if (_isValidForm(formChk, tempTarget)) {
229-
_recordFormAction(tempTarget)
230-
} else
231-
record(
232-
'sendKeys',
233-
locatorBuilders.buildAll(this.recordingState.enterTarget),
234-
'${KEY_ENTER}'
235-
)
206+
record(
207+
'sendKeys',
208+
locatorBuilders.buildAll(this.recordingState.enterTarget),
209+
'${KEY_ENTER}'
210+
)
236211
this.recordingState.enterTarget = null
237212
}
238213
// END

packages/selenium-ide/src/content/selenium-api.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,13 @@ Selenium.prototype.doSubmit = function(formLocator) {
14781478
*
14791479
* @param formLocator an <a href="#locators">element locator</a> for the form you want to submit
14801480
*/
1481+
browser.runtime.sendMessage({
1482+
log: {
1483+
type: 'warn',
1484+
message:
1485+
'submit is deprecated and will be removed from later versions of Selenium IDE, please re-record the step.',
1486+
},
1487+
})
14811488
let form = this.browserbot.findElement(formLocator)
14821489
return bot.action.submit(form)
14831490
}

0 commit comments

Comments
 (0)