- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.6k
 
Tips And Tricks
It may not be immediately obvious, but if you're using a browser that supports it , you can use Action classes and then it's easy to do drag and drop:
 Actions builder = new Actions(driver);
   Action dragAndDrop = builder.clickAndHold(someElement)
       .moveToElement(otherElement)
       .release(otherElement)
       .build();
   dragAndDrop.perform();
   
Currently, only the FirefoxDriver supports this, but you should also expect support for the InternetExplorerDriver too.
This is easy with the FirefoxDriver:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("general.useragent.override", "some UA string");
WebDriver driver = new FirefoxDriver(profile);
Suppose that you wanted to modify the user agent string (as above), but you've got a tricked out Firefox profile that contains dozens of useful extensions. There are two ways to obtain this profile. Assuming that the profile has been created using Firefox's profile manager ("firefox -ProfileManager"):
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("WebDriver");
profile.setPreferences("foo.bar", 23);
WebDriver driver = new FirefoxDriver(profile);
Alternatively, if the profile isn't already registered with Firefox:
File profileDir = new File("path/to/top/level/of/profile");
FirefoxProfile profile = new FirefoxProfile(profileDir);
profile.setPreferences(extraPrefs);
WebDriver driver = new FirefoxDriver(profile);
Native events is such a feature: It is disabled by default for Firefox on Linux as it may cause tests which open many windows in parallel to be unreliable. However, native events work quite well otherwise and are essential for some of the new actions of the Advanced User Interaction. To enable them:
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
WebDriver driver = new FirefoxDriver(profile);
profile.setPreference( "intl.accept_languages", "no,en-us,en" ); 
Look in prefs.js of your Firefox profile.
Goto (url) about:support or FireFox Help menu / Troubleshooting information
This wiki is not where you want to be! Visit the Wiki Home for more useful links
Getting Involved 
Triaging Issues 
Releasing Selenium
Ruby Development 
Python Bindings 
Ruby Bindings 
WebDriverJs
This content is being evaluated for where it belongs
Architectural Overview 
Automation Atoms 
HtmlUnitDriver 
Lift Style API 
LoadableComponent 
Logging 
PageFactory 
RemoteWebDriver 
Xpath In WebDriver
Moved to Official Documentation
Bot Style Tests 
Buck 
Continuous Integration 
Crazy Fun Build 
Design Patterns 
Desired Capabilities 
Developer Tips 
Domain Driven Design 
Firefox Driver 
Firefox Driver Internals 
Focus Stealing On Linux 
Frequently Asked Questions 
Google Summer Of Code 
Grid Platforms 
History 
Internet Explorer Driver 
InternetExplorerDriver Internals 
Next Steps 
PageObjects 
RemoteWebDriverServer 
Roadmap 
Scaling WebDriver 
SeIDE Release Notes 
Selenium Emulation 
Selenium Grid 4 
Selenium Help 
Shipping Selenium 3 
The Team 
TLC Meetings 
Untrusted SSL Certificates 
WebDriver For Mobile Browsers 
Writing New Drivers