简体   繁体   English

如何将Selenium Webdriver放入Java Applet中

[英]How to put selenium webdriver within a Java Applet

I am using selenium to automate some tasks and attempted this with python but had no luck. 我正在使用硒来自动执行一些任务,并尝试使用python进行此操作,但是没有运气。 From what I have been reading Java is the best way to go. 从我一直阅读的内容来看,Java是最好的选择。 I am trying to automate some tasks for myself. 我正在尝试为自己自动化一些任务。 i want to fill out and submit forms using selenium. 我想填写并使用硒提交表格。 The form has 10 fields. 该表格有10个字段。 All fields are automated with selenium except for 3 which i fill out. 除了我要填写的3个字段外,所有字段都自动使用硒。 my problem is, I am able to completely fill out the fields and submit the form using java but I can't figure how to fill in the 3 fields by me (currently i open the selenium java in eclipse, change the 3 fields, compile and then run, need to do this with each new submission). 我的问题是,我能够完全填写字段并使用Java提交表单,但是我无法弄清楚如何由我填写3个字段(目前我在Eclipse中打开Selenium Java,更改3个字段,进行编译然后运行,则需要对每个新提交执行此操作)。

I want to create a JApplet form and enter the 3 fields, then that would put it into selenium java and submit it. 我想创建一个JApplet表单并输入3个字段,然后将其放入Selenium Java中并提交。 I have searched all over and cant find any way to complete this task. 我到处搜索,找不到任何方法来完成此任务。

Clarification 澄清度

**My Current Setup**
Selenium in Java (using eclipse)
Task 1:
- Fields 1 - 7 prefilled and never change.
- I change:
  - WebElement element = driver.findElement(By.name("Type")); element.sendKeys("XXX");
  - WebElement element = driver.findElement(By.name("ID")); element.sendKeys("XXX")
  - WebElement element = driver.findElement(By.name("Manu")); element.sendKeys("XXX");
- Compile and Run
- Selenium goes to website using driver.get("http://www.example.com");
- fills 1 - 10 and hits submit.

Task 2:
- Fields 1 - 7 prefilled and never change.
- I go back into eclipse and change:
  - WebElement element = driver.findElement(By.name("Type")); element.sendKeys("YYY");
  - WebElement element = driver.findElement(By.name("ID")); element.sendKeys("YYY")
  - WebElement element = driver.findElement(By.name("Manu")); element.sendKeys("YYY");
- Compile and Run
- Selenium goes to website using driver.get("http://www.example.com");
- fills 1 - 10 and hits submit.

etc....

I want to make it so I dont have go back each time and change the fields above for each new task. I want to have a web form on a web page have these three fields.

I want:
Task 1
MySite -> FORM with textbox: Type, ID, Manu -> Submit -> fills into the XXX above -> run Selenium
Task 2
MySite -> FORM with textbox: Type, ID, Manu -> Submit -> fills into the YYY above -> run Selenium

hope this makes sense 希望这有意义

I am very confused by your explanation. 您的解释让我很困惑。 In your comment you stated "I want a webpage that has Type, ID, Manu in a Text field then when I hit submit it puts those in selenium". 在您的评论中,您说“我想要一个在文本字段中具有Type,ID,Manu的网页,然后在我点击Submit时将其放入硒中”。 That is not the way Selenium works. 这不是硒的工作方式。 Selenium can be used to take actions on your web page - the same way that a human user would interact with the web page. Selenium可用于在您的网页上执行操作,就像人类用户与网页进行交互的方式一样。 You don't "put things into Selenium" from your web page. 您不会从网页上“将东西放入Selenium”。 It's the other way around. 相反。 Selenium interacts with your web page, clicking buttons, clicking links, typing text, etc. Please clarify your question and post an example of what you are trying to do if necessary. Selenium与您的网页进行交互,单击按钮,单击链接,键入文本等。请澄清您的问题,并在必要时提供示例说明您要尝试执行的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何接受硒中的Java Applet警告警报? - How to accept java applet warning alert in selenium? 如何在java中使用selenium webdriver从excel中为webform(如任何注册页面)赋予价值? - How to put value on webform (like any registration page) from excel using selenium webdriver in java? 硒问题/ Java Applet - Selenium issue / java applet 如何使用带有Java的Selenium Webdriver从包围在多个span标签中的span元素中获取实际文本 - How to get the actual text from a span element enclosed within multiple span tags, using Selenium Webdriver with Java Webdriver支持的Selenium Java-如何验证页面文本中的% - Webdriver backed selenium java - how can I verify % within text on the page 你如何在用java编写的selenium webdriver程序中使用firefox插件? - How do you use a firefox plugin within a selenium webdriver program written in java? 如何使用 Selenium WebDriver 和 Java 在 Swiggy 网站的搜索字段中传递值 - How to pass value in search field within Swiggy website using Selenium WebDriver and Java 如何在Selenium WebDriver(Selenium 2)中运行Firebug? - How do I run Firebug within Selenium WebDriver (Selenium 2)? Java Selenium WebDriver中的if if语句-否定测试 - Java else if statement within selenium webdriver- negative test Webdriver异常-Selenium Webdriver Java - Webdriver Exception - Selenium Webdriver Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM