????λ?????????? >> ??????????
Selenium WebDriver????cookie
???????????? ???????[ 2014/10/9 13:56:57 ] ????????Selenium ??????? cookie
????????????????chrome webdriver
import java.util.Arrays;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
public class DriverFactory {
public static WebDriver create() {
// TODO Auto-generated method stub
String chromdriver="E:\chromedriver.exe";
System.setProperty("webdriver.chrome.driver"?? chromdriver);
ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches"??
Arrays.asList("--start-maximized"));
options.addArguments("--test-type"?? "--start-maximized");
WebDriver driver=new ChromeDriver(options);
return driver;
}
}
?????? ?????browser.data??????cookie ??cookie??????????
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Date;
import java.util.StringTokenizer;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
public class UseCookieLogin {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver=DriverFactory.create();
driver.get("http://selenium.jd-app.com/wp-admin/");
try
{
File file=new File("broswer.data");
FileReader fr=new FileReader(file);
BufferedReader br=new BufferedReader(fr);
String line;
while((line=br.readLine())!= null)
{
StringTokenizer str=new StringTokenizer(line??";");
while(str.hasMoreTokens())
{
String name=str.nextToken();
String value=str.nextToken();
String domain=str.nextToken();
String path=str.nextToken();
Date expiry=null;
String dt;
if(!(dt=str.nextToken()).equals(null))
{
//expiry=new Date(dt);
System.out.println();
}
boolean isSecure=new Boolean(str.nextToken()).booleanValue();
Cookie ck=new Cookie(name??value??domain??path??expiry??isSecure);
driver.manage().addCookie(ck);
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
driver.get("http://selenium.jd-app.com/wp-admin/");
}
}
?????????????е?????????????δ?????????????棬?????????cookie??????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
????????????????AutoRunner??Selenium????????Selenium???????????????????????Selenium?????????????Щ?????????????????£???????Selenium???????????????ζ?Selenium???????????????????Selenium???????????????????????з?????Щ??????????????????????ATF???Selenium??????????????????д???????Selenium?????????????Selenium????????????????????Selenium???????????ATF????θ??????????????????????Selenium??????????????ATFJava?汾??Selenium??????????UI???-Python+Selenium???????Selenium????Webdriver??????????????????η???Selenium?????????Selenium FF WebDriver?????????firebug??2????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????