是否可以执行此 Selenium Firefox IDE? [英] Is it possible to do this Selenium Firefox IDE?

查看:28
本文介绍了是否可以执行此 Selenium Firefox IDE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是这个问题的后续 - 想要创建一个表单填充器——java、jsp、html 就够了吗?.我在网站上反复填写表格(例如私人牙医预约).

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 循环.对于每次迭代,除了下拉框 - 状态"的值外,所有数据都相同.

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

例如.文本框 - 名称"、文本框 - 年龄"在每次迭代中保持不变.但是,状态下拉列表在迭代中更改为 NY、TX、CA.

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 - 如果某些文本出现在最后一页,则执行操作(发送邮件).

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

我如何让硒做到这一切?我必须为每个状态创建一个脚本还是有一个 for 循环?Selenium 可以做第 2 步吗?

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. 您可以使用 Selenium IDE 的流量控制插件获得一个循环.然而,Selenium IDE 的问题由此开始.该工具实际上仅用于基本交互 - 录制、播放、导出.如果您尝试合并一些复杂的逻辑,那将非常困难、不可维护且通常很笨拙.

  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.

如果你想合并......好吧......任何形式的逻辑,你必须使用你想要的任何真正的编程语言和Selenium Webdriver.这将使您几乎可以做任何事情 - 编程语言的全部功能以及完整的浏览器控制.

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.

通常的做法是在 IDE 中记录基础知识,以您喜欢的语言将其导出到 WebDriver,然后从那里继续.

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

您不能在 IDE 中执行此操作.我能想到的唯一方法是存储您要发送的文本,记录自己通过网络邮件发送的邮件,然后播放它.但是拜托,这是一种黑客行为,不应该这样做.任何体面的语言都可以让您以编程方式发送电子邮件.

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.

这篇关于是否可以执行此 Selenium Firefox IDE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆