In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Solve the problem of recording carriage return by adding user-extension.js
1. Write user-extension.js (the file name can be picked at will). The js code for recording enter is as follows:
Recorder.removeEventHandler ('keyDown')
Recorder.addEventHandler ('keyDown',' keydown', function (event) {
Var keynum
If (window.event) / / IE
{
Keynum = event.keyCode
}
Else if (event.which) / / Netscape/Firefox/Opera
{
Keynum = event.which
}
If (keynum==13) {
Var _ this = this
Var target = _ this.findLocator (event.target)
SetTimeout (function () {_ this.record ('keyDown', target,'\\' + keynum);}, 1000); / / delay 1000ms to write back the carriage return record
}
}, {capture: true})
two。 Add a script to IDE (option-IDE extensions):
3. The script binds the keydown event to the Selenium system command keyDown and determines whether the key is 13 (enter). If it is to write a command in IDE, the write command uses this.record ('keyDown', this.findLocator (event.target),'\'+ keynum); where the first parameter is the Command column in IDE, the second parameter is the Target column, and the third parameter is the Value column. {capture: true} indicates recording.
4. System command: can be found in command.
5. Other: you can enter the address in Firefox:
Chrome://selenium-ide/content/recorder-handlers.js looks at click's system events.
Solve the blank jump problem by adding user-extension.js
1. Problem description:
When recording with Selenium-IDE, if there is a new page in the recording page, a warning will be reported when the script is played back, and the page will open in the new window, but the other commands in the script cannot be executed because the id of the new window cannot be determined.
two。 The solution is as follows:
Replace the original click command with open and take out the value from href to the target that was paid to open. This ensures that you can clock in on this page and execute the remaining script commands normally.
3. Script code: write the following code to user-extension.js and add it to the
Option-IDE extensions .
Recorder.removeEventHandler ('clickLocator')
Recorder.addEventHandler ('clickLocator',' click', function (event) {
If (event.button = = 0) {
Var clickable = this.findClickableElement (event.target)
Var href = event.target.getAttribute ("href"); / / event.target is the html tag object
Var blank = event.target.getAttribute ("target")
If (clickable) {
If (this.mouseoverLocator) {
This.record ('mouseOver', this.mouseoverLocator,'')
Delete this.mouseoverLocator
}
If (blanksand blank. IndexOf ("blank") > = 0) {
This.record ("waitForElementPresent", this.findLocators (event.target),''); / / wait for the element to be loaded
This.record ("open", href,'')
}
Else {
This.record ("click", this.findLocators (event.target),'')
}
} else {
Var target = event.target
If (blanksand blank. IndexOf ("blank") > = 0) {
This.record ("waitForElementPresent", this.findLocators (event.target),'')
This.record ("open", href,'')
}
Else {
This.callIfMeaningfulEvent (function () {
This.record ("click", this.findLocators (target),'')
});
}
}
}
}, {capture: true})
Note: in order to ensure the correct execution of the script during playback, it is best to adjust the playback speed to slow, otherwise some commands may fail if the page is not loaded.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.