成都科技网站建设电话多少钱中冶东北建设网站

pingmian/2026/1/23 4:30:11/文章来源:
成都科技网站建设电话多少钱,中冶东北建设网站,网站建设工作是干什么的,app用什么工具开发使用Selenium进行自动化测试一直是将萌芽的自动化测试人员培养为专业人员的生命线。 硒是开源的#xff0c;在全球范围内被广泛采用。 结果#xff0c;您会得到社区的大力支持。 有多种用于不同语言的框架#xff0c;这些框架提供与Selenium的绑定。 因此#xff0c;您已经… 使用Selenium进行自动化测试一直是将萌芽的自动化测试人员培养为专业人员的生命线。 硒是开源的在全球范围内被广泛采用。 结果您会得到社区的大力支持。 有多种用于不同语言的框架这些框架提供与Selenium的绑定。 因此您已经掌握了开始使用Selenium的一切。 现在进入运行第一个测试脚本以使用Selenium执行自动化测试的阶段。 如果您正在学习Selenium自动化那么这些脚本将涉及基本的测试场景。 您可以验证 一个带有Selenium自动化测试的简单登录表单 。 使用Selenium WebDriver捕获网页的屏幕截图 。 在Selenium WebDriver中使用CSS定位器的 Web元素。 设置Selenium Grid以并行执行测试用例。 生成硒测试报告 。 可能还有更多的事情可能有人希望验证因为它的目的是使用Selenium执行自动化测试。 今天我将帮助您使用Selenium进行测试自动化的基本和基本验证之一。 我将演示如何使用Selenium自动化测试来处理多个浏览器选项卡。 实际方案入门 有时您可能会遇到复杂的情况其中可能必须打开新的选项卡或窗口并在打开的选项卡/窗口上执行所需的操作。 开始时处理多个选项卡或窗口可能看起来很复杂但是一旦您知道如何处理它们它就会变得非常容易。 让我们考虑一个场景。 假设您打开了Airbnb的主页并希望在另一个选项卡中打开寄宿家庭的详细信息在打开的选项卡上执行一些操作然后切换回上一个选项卡。 那你怎么做呢 您可以在网上找到与此相关的多种解决方案。 很少有人使用sendkeys方法“ Control t”打开选项卡然后在其中定位主页的正文。 由于sendKeys与浏览器行为有关大多数情况下此方法无效。 因此打开选项卡的最佳方法是使用Robot类或JavascriptExecutor。 机器人课程可确保使用“ Control t”命令打开标签页而通过javascript执行程序您可以使用windows.open轻松打开标签页。 打开选项卡后您可以使用Action Class方法或Selenium WebDriver接口方法getWindowHandlegetWindowHandles切换到选项卡。 我将在本文中展示这两种方法。 为了打开Airbnb中的标签需要解决以下测试步骤。 打开Airbnb URL。 搜索“果阿”位置。 储存任何住宿的网址。 开启新分页 切换到新标签并启动所需的存储URL。 为了打开新标签可以使用以下Robot类代码 Robot r new Robot(); r.keyPress(KeyEvent.VK_CONTROL); r.keyPress(KeyEvent.VK_T); r.keyRelease(KeyEvent.VK_CONTROL); r.keyRelease(KeyEvent.VK_T); 上面的代码有助于使用键盘的control t命令打开选项卡。 可以使用sendKeys来执行此操作但是由于使用它的浏览器的行为它对于工作或不工作的信誉似乎是零星的。 您可以如下使用sendKeys命令来复制上述行为。 driver.findElement(By.cssSelector(“body”)).sendKeys(Keys.CONTROL “t”); 使用Window Handler方法处理Selenium中的选项卡 现在我们要做的就是使用Window Handler方法切换到此打开的选项卡。 以下代码段供您参考 import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.util.Set; import java.util.concurrent.TimeUnit;   import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions;   public class HandlingMultipleTabs {  public static void main(String[] args) throws InterruptedException, AWTException { // TODO Auto-generated method stub         System.setProperty( webdriver.chrome.driver , .\\ChromeDriver\\chromedriver.exe ); WebDriver driver new ChromeDriver(); driver.manage().timeouts().implicitlyWait( 30 , TimeUnit.SECONDS);         //Navigating to airbnb driver.get( https://www.airbnb.co.in/ );         driver.manage().window().maximize();         String currentHandle driver.getWindowHandle();         //locating the location, looking for homestays driver.findElement(By.id( Koan-magic-carpet-koan-search-bar__input )).sendKeys( Goa , Keys.ENTER);         //Clicking on search button driver.findElement(By.xpath( //button[typesubmit] )).click(); String urlToClickdriver.findElement(By.xpath( //div[text()Luxury Three Bedroom Apartment with Pool Jacuzzi]/ancestor::a )).getAttribute( href );         //opening the new tab Robot r new Robot(); r.keyPress(KeyEvent.VK_CONTROL); r.keyPress(KeyEvent.VK_T); r.keyRelease(KeyEvent.VK_CONTROL); r.keyRelease(KeyEvent.VK_T);         //getting all the handles currently available SetString handlesdriver.getWindowHandles(); for (String actual: handles) {             if (!actual.equalsIgnoreCase(currentHandle)) { //switching to the opened tab driver.switchTo().window(actual);              //opening the URL saved. driver.get(urlToClick); } }                         } } 如果要切换回原始选项卡请使用以下命令。 driver.switchTo().defaultContent(); 现在让我们尝试使用JavascriptExecutor打开选项卡并切换到上述相同场景的选项卡。 以下是参考的代码段 import java.util.Set; import java.util.concurrent.TimeUnit;   import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;   public class multipltabsonce123 {  public static void main(String[] args) { // TODO Auto-generated method stub  System.setProperty( webdriver.chrome.driver , .\\ChromeDriver\\chromedriver.exe ); WebDriver driver new ChromeDriver(); driver.manage().timeouts().implicitlyWait( 30 , TimeUnit.SECONDS);         //Navigating to airbnb driver.get( https://www.airbnb.co.in/ );         driver.manage().window().maximize();         String currentHandle driver.getWindowHandle();         //locating the location, looking for homestays driver.findElement(By.id( Koan-magic-carpet-koan-search-bar__input )).sendKeys( Goa , Keys.ENTER);         //Clicking on search button driver.findElement(By.xpath( //button[typesubmit] )).click(); String urlToClickdriver.findElement(By.xpath( //div[text()Luxury Three Bedroom Apartment with Pool Jacuzzi]/ancestor::a )).getAttribute( href );         //opening the new tab ((JavascriptExecutor)driver).executeScript( window.open() );         //getting all the handles currently avaialbe SetString handlesdriver.getWindowHandles(); for (String actual: handles) {             if (!actual.equalsIgnoreCase(currentHandle)) { //switching to the opened tab driver.switchTo().window(actual);              //opening the URL saved. driver.get(urlToClick); } }         }   } 荣誉 您已成功使用Selenium执行了自动化测试以借助Windows Handler方法切换不同的浏览器选项卡。 现在让我们以另一种方式进行研究。 使用Action类处理Selenium中的选项卡 如上所述我们可以使用Window Handler和Action Class切换到选项卡。 下面的代码片段展示了如何使用Action类切换到标签页。 由于动作类也使用sendkey的推断因此在使用中的浏览器中它可能会起作用也可能不会起作用。 import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.util.Set; import java.util.concurrent.TimeUnit;   import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions;   public class HandlingMultipleTabs {  public static void main(String[] args) throws InterruptedException, AWTException { // TODO Auto-generated method stub         System.setProperty( webdriver.chrome.driver , .\\ChromeDriver\\chromedriver.exe ); WebDriver driver new ChromeDriver(); driver.manage().timeouts().implicitlyWait( 30 , TimeUnit.SECONDS);         //Navigating to airbnb driver.get( https://www.airbnb.co.in/ );         driver.manage().window().maximize();         String currentHandle driver.getWindowHandle();         //locating the location, looking for homestays driver.findElement(By.id( Koan-magic-carpet-koan-search-bar__input )).sendKeys( Goa , Keys.ENTER);         //Clicking on search button driver.findElement(By.xpath( //button[typesubmit] )).click(); String urlToClickdriver.findElement(By.xpath( //div[text()Luxury Three Bedroom Apartment with Pool Jacuzzi]/ancestor::a )).getAttribute( href );         //opening the new tab Robot r new Robot(); r.keyPress(KeyEvent.VK_CONTROL); r.keyPress(KeyEvent.VK_T); r.keyRelease(KeyEvent.VK_CONTROL); r.keyRelease(KeyEvent.VK_T);                         //switch using actions class Actions action new Actions(driver); action.keyDown(Keys.CONTROL).sendKeys(Keys.TAB).build().perform();        //opening the URL saved. driver.get(urlToClick);                 }   } 就是这样 您已经使用Windows Handler方法和Action类通过Selenium自动化测试处理了多个浏览器选项卡。 现在我将讨论使用硒的最常见缺点之一。 因此我们知道Selenium WebDriver是用于自动化Web应用程序的出色开源工具。 但是WebDriver的主要难点是测试脚本的顺序执行。 作为解决方案ThoughtWorksSelenium的创始人提出了Selenium Grid以帮助用户同时并行运行多个测试用例。 这大大降低了测试构建的执行。 因此当我们使用Selenium执行自动化测试时我们有一种并行运行多个测试用例的方法。 但是它的可扩展性如何 建立自己的Selenium Grid将需要大量的CPU消耗并且维护起来很麻烦。 您希望使用Selenium执行并行执行的测试数量对计算的需求越高。 所以你可以做什么 如何使用Selenium进行大规模自动化测试 使用Selenium on Cloud执行自动化测试 基于云的Selenium Grid可以让您运行测试用例而无须设置基础架构。 您所需要的只是一个互联网连接。 我们拥有多种平台可帮助我们提供丰富的浏览器版本移动设备Android版本等。 让我们在LambdaTest Selenium Grid上执行上述测试案例。 我将展示如何在基于云的平台上打开多个选项卡以及访问LambdaTest所需的详细信息例如视频屏幕截图控制台日志等。 您需要做的就是在实例化remoteWebDriver的同时设置LambdaTest URL。 此URL是用户名访问密钥和LambdaTest集线器URL的组合。 现在您需要做的就是定义所需的平台浏览器版本和附加组件。 完成此设置过程后请使用相同的多标签脚本并在LambdaTest平台上运行它。 以下是参考代码段 import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.net.URL; import java.util.Arrays; import java.util.Set; import java.util.concurrent.TimeUnit;   import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test;   public class HandlingMultipleTabs {       public RemoteWebDriver driver null ; public String url https://www.lambdatest.com/ ; public static final String username sadhvisingh24 ; // Your LambdaTest Username public static final String auth_key abcdefghi123456789 ; // Your LambdaTest Access Key public static final String URL hub.lambdatest.com/wd/hub ; //This is the hub URL for LambdaTest         BeforeClass public void setUp() { DesiredCapabilities capabilities new DesiredCapabilities(); browserName capabilities.setCapability( browserName , chrome ); capabilities.setCapability( version , 73.0 ); win10 capabilities.setCapability( platform , win10 ); // If this cap isnt specified, it will just get the any available one capabilities.setCapability( build , MultipleTabs_Lambdatest ); capabilities.setCapability( name , MultipleTabs_Lambdatest ); capabilities.setCapability( network , true ); // To enable network logs capabilities.setCapability( visual , true ); // To enable step by step screenshot capabilities.setCapability( video , true ); // To enable video recording capabilities.setCapability( console , true ); // To capture console logs try {              driver new RemoteWebDriver( new URL( https:// username : auth_key URL), capabilities);                 }       catch (Exception e) {                 System.out.println( Invalid grid URL e.getMessage()); }     System.out.println( The setup process is completed );     }         Test public void handleMultipleTabs() throws InterruptedException, AWTException { // TODO Auto-generated method stub         driver.manage().timeouts().implicitlyWait( 30 , TimeUnit.SECONDS);         //Navigating to airbnb driver.get( https://www.lambdatest.com );         driver.manage().window().maximize();         String currentHandle driver.getWindowHandle();         //locating the blog url String urlToClickdriver.findElement(By.xpath( //a[text()Blog] )).getAttribute( href );                 //opening the new tab ((JavascriptExecutor)driver).executeScript( window.open() );         //getting all the handles currently availabe SetString handlesdriver.getWindowHandles(); for (String actual: handles) {             if (!actual.equalsIgnoreCase(currentHandle)) { //switching to the opened tab driver.switchTo().window(actual);              //opening the URL saved. driver.get(urlToClick); } }                        }  AfterClass public void closeDown() { driver.quit(); } } 上面的脚本将帮助您通过零停机时间的云Selenium Grid处理Selenium中的浏览器选项卡。 您可以在LambdaTest自动化仪表板上查看这些测试的状态。 在LambdaTest上使用Selenium执行自动化测试时您可以查看视频屏幕截图控制台输出以及更多内容。 下面引用的屏幕截图 测试的控制台输出 结论 我们演示了使用Selenium进行的自动化测试以使用Action Class和Windows Handler方法处理多个选项卡。 我们开始意识到在本地运行Selenium WebDriver和Grid的痛苦点。 转向基于 LambdaTest之类的基于云的Selenium Grid可以帮助您轻松扩展因此您可以大大减少构建时间并更快地交付产品。 如果您对此主题有任何疑问请告诉我。 我将针对Selenium自动化测试的基本主题撰写更多文章以帮助您更好地成长为专业的自动化测试人员。 请继续关注更多快乐的测试 翻译自: https://www.javacodegeeks.com/2019/07/handling-multiple-browser-selenium-automation-testing.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/86599.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网站标签化自学ui设计需要哪些资料

http://blog.csdn.net/GarfieldEr007/article/details/50151845 第十二章 小波变换 目录 1 引言 2 连续小波变换 3 二进小波变换 3.1 Haar变换 4 离散小波变换 4.1 多分辨率分析 4.2 快速小波变换算法 4.3 离散小波变换的…

如何开微信小程序店铺门户网站优化

作为家长,你是否经常为孩子的健康担忧,也一直在寻找一种可以与孩子一起运动、记录运动数据并让孩子产生对运动感兴趣的设备? 那不妨试试华为儿童手表,一款拥有专业的运动模式的智能手表。孩子只需简单操作手表,就能开…

迅雷资源做下载网站python网站开发流程图

密码是每个人最私密的东西,轻易是不会展示给他人的,那么我如何能知道你电脑上浏览器里保存的密码呢?浏览器是大家在网上冲浪最常用的软件,在登录一些网站填写账号密码后,浏览器为了方便大家使用,会提示是否…

拍拍网的网站建设制作网站代码吗

人工智能早已不再被视为未来科技,而是越来越多地应用在时下人们的生活之中。根据DECO PROTESTE的调查,大约72%的葡萄牙人认为人工智能已经活跃于他们的日常。[1] 随着ChatGPT对各个行业的影响,也引发了人们关于这种人工智能模型潜力的争论&a…

做外贸的网站平台有哪些广西城乡建设部网站

技术咨询:wulianjishu666 上午:UDP网络编程 下午:UDP聊天程序的设计、select超时控制 教学内容: 1、udp和tcp都是在传输层上的协议,它们的区别 UDP协议与TCP协议的差异: TCP:面向连接,可靠 UDP:无连接,不可靠 ----------------------- UDP协议的优势: 支持…

网站建设和维护pdf驻马店市旅游网站建设

在前端开发中,表单是非常常见的交互组件之一。为了实现表单数据的双向绑定和验证,Vue提供了一些强大的功能和方法。以下将详细介绍Vue中如何处理表单数据的双向绑定和验证,并提供具体的代码示例,以帮助读者更好地掌握这方面的知识…

如何做网站么最好的网站设计公司源码 php

https://www.ghostxpsp3.net/czxtjc/12280.html 对于没有U盘系统和光驱的用户来说,使用硬盘安装系统,无疑是最好的解决方案。今天笔者教你如何一步步从硬盘安装win10系统,笔者教你如何一步步从硬盘安装win10系统要保证在能进入系统的前提下进…

宏大建设集团有限公司网站wordpress 导航 防刷新

1、安装插件 打开vscode,选择扩展,搜索leetcode,选择第一个,带有中文力扣字样,安装后重启 2、切换 选择这个小球,切换中文版本,切换后,会显示一个打勾 3、 选择小球旁边的有箭…

移动手机号码网站90设计网图片

前向传播神经网络搭建 1.tensorflow库搭建神经网络 参数:线上的权重W,用变量表示,随机给初值。相关介绍 tf.truncated_normal():去掉过大偏离点的正太分布tf.random_normal()正太分布tf.random_uniform():平均分布tf.zeros:全零数组&#x…

ppt模板免费下载网站知乎同性做视频网站

二、 前期准备 前期准备主要包括两个方面:实习和简历。一般10月份开始找的话,最好1、2月份准备,也就是说提前半年,我是4月份开始作的准备。当时准备的主要内容就是:确定自己的求职目标,写好简历&#x…

自己建设网站需要具备哪些条件创客贴网站建设

Linux进程控制(2) 📟作者主页:慢热的陕西人 🌴专栏链接:Linux 📣欢迎各位大佬👍点赞🔥关注🚓收藏,🍉留言 本博客主要内容讲解了进程等待收尾内容和进程的程序…

那些网站做任务领q币东莞公司网站价格

C语言中如何使用宏C(和C)中的宏(Macro)属于编译器预处理的范畴,属于编译期概念(而非运行期概念)。下面对常遇到的宏的使用问题做了简单总结。 关于#和## 在C语言的宏中,#的功能是将其…

天津做淘宝网站教务系统登录入口

下列代码都是以自己的项目实例讲述的,相关的文本内容很少,主要说明全在代码注释中。我是使用阿里云云通信的短信服务,第一次使用会摸不着头绪,这里我们需要做些准备工作:1、登陆自己的账号进入阿里云官网,没…

深圳做微信网站制作成都有哪些做网站开发的大公司

if __name__ __main__: 是一个常见的 Python 代码块,通常作为程序的主入口。 这个代码块通常用于包含脚本的主要功能或逻辑,它会在脚本被直接执行时运行,但不会在脚本作为模块导入时运行。 其中,__name__ 是 Python 中的一个特…

潍坊专业网站建设价格低专业的天津网站建设

前端问题合集:VueElementUI 1. Vue引用Element-UI时,组件无效果解决方案 前提: 已经安装好elementUI依赖 //安装依赖 npm install element-ui //main.js中导入依赖并在全局中使用 import ElementUI from element-ui Vue.use(ElementUI)如果此…

wordpress 不能换主题东莞网站优化教程

『Postman入门万字长文』| 从工具简介、环境部署、脚本应用、Collections使用到接口自动化测试详细过程 1 Postman工具简介2 Postman安装3 Postman界面说明4 一个简单请求4.1 请求示例4.2 请求过程 5 Postman其他操作5.1 import5.2 History5.3 Environment5.4 Global5.5 其他变…

免费网站的软件网站开发任务需求书

Mysql 数据库是所有软件体系中最核心的存在 DBA 1.1什么是数据库 数据库(DB,DataBase) 概念:数据仓库,软件,安装在操作系统上(window,linux...) 作用:存…

十大中国网站制作门户网站英文

文章目录一、 编辑配置文件1.1. 进入tomcat的conf目录1.2. 编辑tomcat-users.xml文件1.3. 添加配置信息二、 配置说明三、 启动tomcat服务3.1. 启动tomcat3.2. 浏览器访问3.3. 点击Manager App访问4033.4. 编辑配置文件3.5. 注释value部分3.6. 浏览器再次请求四、新建任务&…

网上做论文的网站软件工程师是做什么的

一.DDT简介 Data Driven Testing,数据驱动,简单来说就是测试数据的参数化 Python数据驱动模块DDT,包含类的装饰器ddt和两个方法装饰器data(直接输入测试数据) 通常情况下,data中的数据按照一个参数传递给…