我想自动化文件上传过程,该过程使用内置bootstrap的文件上传控件.我正在使用webdriver做同样的事情.下面是我的代码,但不幸的是它不起作用:
element=driver.findElement(By.xpath("//[@id='upload']/fieldset/div[2]/input[1]"));
element.sendKeys(pathToFile);
Run Code Online (Sandbox Code Playgroud)
它给出了一个element not visible错误.
以下是我试图自动化的bootstrap fileupload控件示例 - 通过JavaScript:在此URL上http://markusslima.github.io/bootstrap-filestyle/ 请参阅下面的样式 -
$(":file").filestyle({icon: false});
Run Code Online (Sandbox Code Playgroud) 我已经从门户中创建了一个 SAS 令牌,一切正常,我可以访问私有 blob。
我正在尝试使用此函数动态创建新的 SAS 令牌:
function generateSasToken($uri, $sasKeyName, $sasKeyValue)
{
$targetUri = strtolower(rawurlencode(strtolower($uri)));
$expires = time();
$expiresInMins = 60;
$week = 60*60*24*7;
$expires = $expires + $week;
$toSign = $targetUri . "\n" . $expires;
$signature = rawurlencode(base64_encode(hash_hmac('sha256',
$toSign, $sasKeyValue, TRUE)));
$token = "SharedAccessSignature sr=" . $targetUri . "&sig=" . $signature . "&se=" . $expires . "&skn=" . $sasKeyName;
return $token;
}
Run Code Online (Sandbox Code Playgroud)
这确实会生成 SAS 令牌,但其格式与从门户生成的帐户范围略有不同。
当尝试使用令牌时,我收到错误:
<Error>
<Code>AuthenticationFailed</Code>
<Message>
Server failed to authenticate the request. Make sure the value …Run Code Online (Sandbox Code Playgroud)