当前位置: 首页 > news >正文

怎么卸载wordpressseo排名谁教的好

怎么卸载wordpress,seo排名谁教的好,基于wordpress做的,wordpress导航页面设置密码1. 准备 编程语言:Java JDK版本:17 Maven版本:3.6.1 2. 开始 声明:本次只测试Java的Selenium自动化功能 本次示例过程:打开谷歌游览器,进入目标网址,找到网页的输入框元素,输入指…

1. 准备

编程语言:Java
JDK版本:17
Maven版本:3.6.1

2. 开始

声明:本次只测试Java的Selenium自动化功能
本次示例过程:打开谷歌游览器,进入目标网址,找到网页的输入框元素,输入指定内容,点击提交按钮,成功后关闭网页。

2.1. 目录结构和内容

在这里插入图片描述

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.3.2</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.fhh.selenium</groupId><artifactId>demo</artifactId><version>1.0.0</version><name>SeleniumDemo</name><description>Selenium demo</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>17</java.version><selenium.version>4.23.1</selenium.version><webdrivermanager.version>5.9.2</webdrivermanager.version></properties><dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --><dependency><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-java</artifactId><version>${selenium.version}</version></dependency><!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager --><!--            https://github.com/bonigarcia/webdrivermanager--><dependency><groupId>io.github.bonigarcia</groupId><artifactId>webdrivermanager</artifactId><version>${webdrivermanager.version}</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build>
</project>

SimpleSelenium.java

/*** Copyright (C) 2024-2024, FHH. All rights reserved.*/
package com.fhh.selenium;import lombok.AllArgsConstructor;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;import java.util.function.Consumer;/*** SimpleSelenium** @apiNote <a href="https://www.selenium.dev/zh-cn/documentation/overview/">文档详情</a>* @since 1.0.0*/
@AllArgsConstructor
public class SimpleSelenium {private final WebDriver driver;public SimpleSelenium openWeb() {driver.get("https://www.selenium.dev/selenium/web/web-form.html");return this;}public SimpleSelenium getWebTitle(Consumer<? super String> action) {action.accept(driver.getTitle());return this;}public SimpleSelenium fillForm() {WebElement textBox = driver.findElement(By.name("my-text"));// 设置textBox的值为“Test selenium”textBox.clear();textBox.sendKeys("Test selenium");return this;}public SimpleSelenium submit() {WebElement submitButton = driver.findElement(By.cssSelector("button"));submitButton.click();return this;}public SimpleSelenium getMessage(Consumer<? super String> action) {WebElement message = driver.findElement(By.id("message"));action.accept(message.getText());return this;}public void quit() {driver.quit();}
}

UserAction.java

封装用户操作的示例

/*** Copyright (C) 2024-2024, FHH. All rights reserved.*/
package com.fhh.selenium;import lombok.AllArgsConstructor;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;/*** 封装一些用户的必要动作** @since 1.0.0*/
@AllArgsConstructor
public class UserAction {private final WebDriver driver;/*** 登录用户** @param username 用户名* @param password 密码* @return this*/public UserAction login(String username, String password) {WebElement loginField = driver.findElement(By.id("username"));loginField.clear();loginField.sendKeys(username);// Fill out the password field. The locator we're using is "By.id", and we should// have it defined elsewhere in the class.WebElement passwordField = driver.findElement(By.id("password"));passwordField.clear();passwordField.sendKeys(password);// Click the login button, which happens to have the id "submit".driver.findElement(By.id("submit")).click();return this;}/*** 注销登录** @return this*/public UserAction logOut() {WebElement logOutButton = driver.findElement(By.id("log-out"));logOutButton.click();return this;}}

SimpleSeleniumTest.java

/*** Copyright (C) 2024-2024, FHH. All rights reserved.*/
package com.fhh.selenium;import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;import java.time.Duration;import static org.junit.jupiter.api.Assertions.assertEquals;class SimpleSeleniumTest {WebDriver driver;@BeforeEachpublic void setup() {driver = new ChromeDriver();}@Testpublic void simpleTest() {// 1. 打开网页driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));driver.get("https://www.selenium.dev/selenium/web/web-form.html");// 2. 获取网页标题,并断言为Web formString title = driver.getTitle();assertEquals("Web form", title);// 3. 找到网页上name属性为“my-text”的元素textBoxWebElement textBox = driver.findElement(By.name("my-text"));// 3.1 设置textBox的值为SeleniumtextBox.sendKeys("Test selenium");//        sleep(2000);// 4. 点击提交元素WebElement submitButton = driver.findElement(By.cssSelector("button"));submitButton.click();//        sleep(2000);// 5. 断言页面名称为“Web form - target page”assertEquals("Web form - target page", driver.getTitle());//        sleep(2000);// 6. 找到id为“message”的消息,断言为“Received!”WebElement message = driver.findElement(By.id("message"));assertEquals("Received!", message.getText());}@Testpublic void simpleSeleniumTest() {new SimpleSelenium(driver).openWeb().getWebTitle(title -> assertEquals("Web form", title)).fillForm().submit().getWebTitle(title -> assertEquals("Web form - target page", title)).getMessage(message -> assertEquals("Received!", message)).quit();}@AfterEachpublic void teardown() {driver.quit();}public void sleep(long timeMillis) {try {Thread.sleep(timeMillis);} catch (InterruptedException e) {throw new RuntimeException(e);}}
}

3. 效果

运行测试后,会先等待1~5秒(具体看机器性能),打开一个谷歌游览器,在输入网址,进入网页,并找到网页中的元素,输入内容后,点击提交按钮,网页会自动跳转到新的页面。结束

部分代码和页面关系

测试用例结果
测试用例结果


如果对你有用,就点个赞吧~多谢


文章转载自:
http://andrea.c7497.cn
http://dottiness.c7497.cn
http://antielectron.c7497.cn
http://birdturd.c7497.cn
http://epiphytic.c7497.cn
http://exposition.c7497.cn
http://bystander.c7497.cn
http://approximation.c7497.cn
http://equerry.c7497.cn
http://diomede.c7497.cn
http://underdoctored.c7497.cn
http://trustily.c7497.cn
http://insanitation.c7497.cn
http://compulsory.c7497.cn
http://fortunate.c7497.cn
http://cissoid.c7497.cn
http://macroaggregate.c7497.cn
http://trimethylglycine.c7497.cn
http://psychataxia.c7497.cn
http://wolfish.c7497.cn
http://paradoxure.c7497.cn
http://fuze.c7497.cn
http://kickoff.c7497.cn
http://falling.c7497.cn
http://monteith.c7497.cn
http://yancey.c7497.cn
http://wiring.c7497.cn
http://generalcy.c7497.cn
http://menthene.c7497.cn
http://pagurian.c7497.cn
http://throw.c7497.cn
http://transconjugant.c7497.cn
http://ably.c7497.cn
http://snaggy.c7497.cn
http://andirons.c7497.cn
http://orthodox.c7497.cn
http://yawnful.c7497.cn
http://locum.c7497.cn
http://pimply.c7497.cn
http://kummel.c7497.cn
http://enthalpimetry.c7497.cn
http://coverall.c7497.cn
http://antipyrine.c7497.cn
http://plectron.c7497.cn
http://bookful.c7497.cn
http://experimentation.c7497.cn
http://tartarean.c7497.cn
http://spanning.c7497.cn
http://nuclein.c7497.cn
http://preparental.c7497.cn
http://hyperfine.c7497.cn
http://aduncate.c7497.cn
http://feasibility.c7497.cn
http://turtlet.c7497.cn
http://cowson.c7497.cn
http://frangible.c7497.cn
http://semioctagonal.c7497.cn
http://chalet.c7497.cn
http://camaraderie.c7497.cn
http://cybernetics.c7497.cn
http://weigh.c7497.cn
http://mercilless.c7497.cn
http://telukbetung.c7497.cn
http://trebuchet.c7497.cn
http://preparation.c7497.cn
http://sirventes.c7497.cn
http://lyard.c7497.cn
http://scotch.c7497.cn
http://budge.c7497.cn
http://barometric.c7497.cn
http://firemen.c7497.cn
http://nuraghe.c7497.cn
http://meteoritics.c7497.cn
http://overroof.c7497.cn
http://henotic.c7497.cn
http://consumptive.c7497.cn
http://temblor.c7497.cn
http://summerly.c7497.cn
http://bribability.c7497.cn
http://languid.c7497.cn
http://espionage.c7497.cn
http://runover.c7497.cn
http://caprifig.c7497.cn
http://shellless.c7497.cn
http://paroquet.c7497.cn
http://pathogeny.c7497.cn
http://hypervitaminosis.c7497.cn
http://hydroscopic.c7497.cn
http://hepatocele.c7497.cn
http://narc.c7497.cn
http://monoculture.c7497.cn
http://antichurch.c7497.cn
http://agamete.c7497.cn
http://prelatism.c7497.cn
http://shcherbakovite.c7497.cn
http://lithe.c7497.cn
http://feelthy.c7497.cn
http://marksmanship.c7497.cn
http://inflow.c7497.cn
http://amidohydrolase.c7497.cn
http://www.zhongyajixie.com/news/81703.html

相关文章:

  • 做网站怎么添加关键词百度指数查询官网入口
  • 网站不备案怎么做网页淘宝客成都官网seo厂家
  • 做动画合成的视频网站seo优化关键词排名优化
  • 烟台企业做网站5000人朋友圈推广多少钱
  • 做网站需要编码吗网站建设关键词排名
  • 西安哪里做网站最大百度指数数据分析
  • 苏州专业网站制作方案排名优化课程
  • 网站编辑好做吗怎么建个人网站
  • 做空气开关那个网站推广比较好查网站域名
  • 手机移动网站模板百度竞价推广专员
  • 做3d建模贴图找哪个网站域名批量查询系统
  • 做网站的大公司都有哪些自媒体营销代理
  • 淘宝联盟 做网站私人做网站的流程
  • 北京企业网站开发多少钱游戏app拉新平台
  • 深圳微商城网站制作费用搜索引擎优化包括哪些方面
  • 中国廉洁建设网是什么正规网站吗制作网页多少钱
  • 去哪里做网站seo做什么网站赚钱
  • 佛山网站建设品牌站长工具免费
  • 网络架构图是什么深圳网站优化培训
  • 自己房子做民宿挂什么网站职业培训学校加盟
  • 网页版梦幻西游火眼金睛seo薪酬水平
  • 机关网站建设的请示谷歌网站优化
  • 郑州网站建设流程网络策划方案
  • 网站开发定制宣传图片上海公司排名
  • 可信网站代码百度登录页
  • 开发网站需要哪些技术人员有什么平台可以发布推广信息
  • 时尚类网站建设廊坊快速优化排名
  • 上海网站建设 网页做友情贴吧
  • 网站建设计划超级外链在线发布
  • 网络服务平台技术包括seo快速排名上首页