利用Selenium实现后台影片的循环添加

本文介绍如何利用Selenium在后台进行影片信息的循环添加,避免使用Xpath的绝对路径,包括登录步骤、进入影片管理页面以及实现5条记录的连续添加与保存。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

利用Selenium实现后台影片的循环添加

禁止使用Xpah的绝对路径,如:/html/body/header/nav/div[2]/ul/li[3]/a。如每出现一处,扣10分,出现2处,扣除20分,依次类推。

1、实现登录

2、点击“影片管理/添加影片信息”

3、利用循环实现5条记录的添加并保存

package homework1;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;

public class Movie {
   


	public static void main(String[] args) throws InterruptedException {
   
		
//		登录
		String url = "http://localhost:8032/mymovie/admin.php/Login/index.html";
		
		System.setProperty("webdriver.gecko.driver", "D:\\Demo\\geckodriver.exe");
		System.setProperty("webdriver.firefox.bin","F:\\software\\firefox.exe" )
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值