Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7590013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:18:10+00:00 2026-05-30T20:18:10+00:00

Selenium was apparently not designed to allow you modify the DOM of the browser

  • 0

Selenium was apparently not designed to allow you modify the DOM of the browser pages, but I occasionally need to insert HTML elements dynamically.

In this instance: I am using Firefox with the Selenium IDE to record listing of auctions on eBay, but I noticed it cannot cope with the heavily JScripted auction content control and records nothing for those elements.

If I turn off JavaScript for the ebay site the much simpler version of the first auction entry page is broken (it is missing a hidden input element required to confirm PayPal as a payment option).

So, my options at the moment are… A) figure out how to interact with the fancy JScript HTML editor control from Selenium, or b) insert new elements into the DOM.

Does anyone have any suggestions, preferably in C# as I am automating this under a Windows console Application? A Selenium User-Extensions would also be acceptable if anyone has the code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:18:10+00:00Added an answer on May 30, 2026 at 8:18 pm

    I have found one solution so far so I thought it best to share it for review/improvement.

    Selenium allows you to extend its behavior with a user-extensions.js file.

    For example this creates a new insertHtml command within Selenium:

    Selenium.prototype.doInsertHtml = function(locator, text){
        var element = this.page().findElement(locator);
        var innerHTML = text + element.innerHTML;
        element.innerHTML = innerHTML;
    }
    

    For Selenium IDE usage you simply include the extensions file via the options menu of the IDE itself. Next time you start the IDE it automatically has any new commands available (from the user extensions file).

    As the Documentation page address changed, and may again, I have copied the relevant part below:

    Extending Selenium

    It can be quite simple to extend Selenium, adding your own actions, assertions and locator-strategies. This is done with javascript by adding methods to the Selenium object prototype, and the PageBot object prototype. On startup, Selenium will automatically look through methods on these prototypes, using name patterns to recognise which ones are actions, assertions and locators.

    The following examples try to give an indication of how Selenium can be extended with javascript.

    Actions

    All doFoo methods on the Selenium prototype are added as actions. For each action foo there is also an action fooAndWait registered. An action method can take up to 2 parameters, which will be passed the second and third column values in the test.

    Example: Add a “typeRepeated” action to Selenium, which types the text twice into a text box.

    Selenium.prototype.doTypeRepeated = function(locator, text) {
        // All locator-strategies are automatically handled by "findElement"
        var element = this.page().findElement(locator);
    
        // Create the text to type
        var valueToType = text + text;
    
        // Replace the element text with the new text
        this.page().replaceText(element, valueToType);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

usually selenium does not identify elements on a browser toolbar. But this is for
I am testing using Selenium RC but most of the waitforNottext etc are not
Running Selenium 1 locally (not through grid) all the supported browser strings are prefixed
Can Selenium or any other automated tool check for the proper positioning of elements
I'm running Selenium tests from within Eclipse, but I can't load a custom Firefox
In selenium IDE, I need to find the 3rd link whose text is 'XXX'
In selenium IDE, I need to click on the nth link that has text
We have a Selenium WebElement we're getting from the Java API but we've created
Use Selenium a lot, but wondering the folowing question Just a little bit curious,
I see that Selenium 2 now supports WebDriverEventListener but the events don't really seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.