Search code examples
rubywatirfirewatirautomated-testsbrowser-automation

How can I make a text_field that is disabled until typed into enabled using firewatir?


When attempting to setup a Job Title the "add job title" buttons are hidden until text is entered. Using the following code to add a job title the disabled button does not become enabled.

browser.text_field(:name, "addJobTitleValue").set firstJobTitle

script referring to disabled button the actual button that stays hidden

Is there a way to set the text_field and have the button become enabled?


Solution

  • By using the watir-webdriver versus firewatir I was able to use these lines of code to enable the button:

    browser.text_field(:name, 'addJobTitleValue').clear
    browser.text_field(:name, 'addJobTitleValue').fire_event 'onclick'
    browser.text_field(:name, 'addJobTitleValue').send_keys firstJobTitle
    

    This has solved the problem to me and convinced me officially to start the switch to watir-webdriver.