简体   繁体   English

如何将对浏览器的控制从一个硒Java客户端传递给另一个?

[英]How do I pass control of a browser from one selenium java client to another?

I have some scripts (in fitnesse) that executes some selenium commands. 我有一些脚本(适合运行),可以执行一些硒命令。 However, there are some processes wherein it would be too complex (or hackish) with a plain selenium (+fitnesse) approach, so I'm planning to create my own class which will handle those complex processing (ie check if the items in the table are sorted in ascending date). 但是,在某些过程中,使用普通的硒(+ fitnesse)方法可能会太复杂(或有些杂乱),因此我打算创建自己的类来处理那些复杂的处理(即,检查是否存在表按升序排序)。

This class would then have to take control of the browser that the first selenium java client has launched (ie after logging in, navigating to some pages, doing some other actions), and then do its specialized actions. 然后,此类将必须控制第一个Selenium Java客户端启动的浏览器(即登录后,导航到某些页面,执行一些其他操作),然后执行其专门的操作。

How would I be able to do that with the selenium java client? 我将如何使用Selenium Java客户端做到这一点?

Generally speaking you can do this if you have the Selenium session ID. 一般来说,如果您具有Selenium会话ID,则可以执行此操作。 The session ID is how the Selenium server associates a command with a particular browser. 会话ID是Selenium服务器将命令与特定浏览器关联的方式。

As for how you go about passing that around or using it in the Java client, I'd dig into the javadocs. 至于如何传递或在Java客户端中使用它,我将深入探讨javadocs。 But I do this in Ruby and it works quite well. 但是我在Ruby中执行此操作,效果很好。

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

相关问题 如何使用Selenium和Java将控件从1个Chrome浏览器切换到另一个 - how to switch the control from 1 chrome browser to another using selenium with java 如何在Java中将在一个类中创建的对象传递给另一个类? - How do I pass an object created in one class to another in java? 如何在Java中将变量从一类传递到另一类? - How Do You Pass a Variable from One Class to Another in Java? 我如何通过 ArrayList<string> 在 Java 中从一种方法到另一种方法。 变量未初始化错误</string> - How do I pass an ArrayList<String> from one method to another in Java. Variable not initialised error 如何在Java中将方法或对象从客户端传递到服务器? - How do I pass a method or object from client to server in Java? 如何在Java中将变量从一类传递到另一类? - How can I pass variables from one class to another in Java? 如何使用带有Java的Selenium WebDriver将一个类的值传递给另一个类? - How can I pass one class value into another class using Selenium WebDriver with Java? 如何将int值从一种方法传递给另一种方法 - How do I pass int values from one method to another 如何将信息从一个对象传递到另一个 - How do I pass information from one object to another 如何将值从一类传递到另一类? - How do I pass the values from one class to another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM