Is it possible to do this Selenium Firefox IDE?

时光毁灭记忆、已成空白 提交于 2019-12-04 06:09:45

问题


This is a follow up to this question - Want to create a form filler - is java, jsp, html enough?. I am repeatedly filling a form on a website (Eg. private dentist reservation).

1 - For loop. For each iteration, all data is same except the value of a "dropdown box - state".

eg. "Text box - name", "text box - age" remain the same in each iteration. But, the state drop down changes to NY, TX, CA in an iteration.

2 - Perform an action (send mail) if certain text occurs in the final page.

How do I make selenium do all this ? Do I have to create a script for each state or there is a for loop ? Can Selenium do step 2 ?


回答1:


  1. You can get a loop with a the Flow control plugin for Selenium IDE. However, here begins the problem with Selenium IDE. The tool is really meant only for basic interactions - recording, playing, exporting. If you tried to incorporate some complicated logic, it would be very hard, unmaintainable and very often hacky.

    If you want to incorporate ... well ... any form of logic, you'll have to use any real programming language you want with Selenium Webdriver. This will enable you to do literally anything - full power of a programming language together with full browser control.

    A common practice is to record the basics in IDE, export it to WebDriver in your favorite language, and carry on from there.

  2. You can't do this in IDE. The only way I could think of is to store the text you want to send, record yourself sending a mail via a webmail, then playback it. But please, it's a hack and should not be done this way. Any decent language will enable you to send e-mails programatically.



来源:https://stackoverflow.com/questions/17357580/is-it-possible-to-do-this-selenium-firefox-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!