Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium rc 如何使用selenium创建cookie?_Selenium Rc - Fatal编程技术网

Selenium rc 如何使用selenium创建cookie?

Selenium rc 如何使用selenium创建cookie?,selenium-rc,Selenium Rc,我想使用selenium创建一个cookie。我见过一个支持这种方法,比如selenium.createcookie(arg1,arg0),但我对传递的参数有点困惑。有人能给我举个例子吗?createCookie(nameValuePair,OptionString) 创建一个新cookie,其路径和域与当前测试页面的路径和域相同,除非您明确为此cookie指定了路径 Arguments: nameValuePair - name and value of the cookie in a fo

我想使用selenium创建一个cookie。我见过一个支持这种方法,比如
selenium.createcookie(arg1,arg0)
,但我对传递的参数有点困惑。有人能给我举个例子吗?

createCookie(nameValuePair,OptionString) 创建一个新cookie,其路径和域与当前测试页面的路径和域相同,除非您明确为此cookie指定了路径

Arguments:

nameValuePair - name and value of the cookie in a format "name=value"
optionsString - options for the cookie. Currently supported options include 'path' and 'max_age'. the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit of the value of 'max_age' is second.
论据:

  • nameValuePair-的名称和值 cookie的格式为“name=value”

  • 选项字符串-用于 曲奇当前支持的选项 包括“路径”和“最大年龄”。这个 选项字符串的格式为 “路径=/path/,最大年龄=60岁”。命令 所有选项都是无关的,单位 “max_age”值的最大值是第二个

  • 资料来源:

    创建一个新cookie,其路径和域与当前测试页面的路径和域相同,除非您明确为此cookie指定了路径

    Arguments:
    
    nameValuePair - name and value of the cookie in a format "name=value"
    optionsString - options for the cookie. Currently supported options include 'path' and 'max_age'. the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit of the value of 'max_age' is second.
    

    使用firefox访问您选择的网站(创建cookie),然后进入编辑>首选项>隐私>删除单个cookie。单击其中一个cookie。这将使您了解如何使用createCookie调用。我将选项域的术语转换为主机术语,效果很好

    我们可以在任何参数中给出cookie域吗?因为cookie应该被添加到某个xyz域中。请帮助我猜您可以将domain=属性设置为optionString参数中的选项之一。