0

実際には2つの質問:

最初のもの: 特定の URL (about:blank の代わりに) でブラウザを起動する方法はありますか (その URL で起動するときに履歴の長さを 0 にしたいですか?)

2つ目:これは上記の質問に関連していると思います

ページには次のものがあります。

 <script type="text/javascript">
 function backAway(){
    if (navigator.appName == 'Microsoft Internet Explorer'){
       // under ie
       i = 0;
    } else {
    //firefox, chrome, etc..
       i = 1;
    }
    if (history.length>i)
        {
        // there appear to be items in the history property
        // this seems to happen with Firefox
        // If refferer exists, then do a back
        if (document.refferer){
            history.back();
        } else {
            window.close();
        }
    } else {
        window.close();
    }
    return false;
 }
 </script>


 <a href="" id="declineButton" title="Cancel" class="canc" onclick="backAway(); return     false;">Cancel</a>

ここにpythonセレンのもの:

 driver = webdriver.Firefox()
 driver.get(urlOAuth)
 declineButtons = driver.find_elements_by_id('declineButton'])
 declineButtons[0].click()

denyButton は正常に検出されますが、クリックしても効果がないように見えます。Selenium を使用しない場合、ページは正しく機能しているように見えます。

何かご意見は?提案?質問?

4

1 に答える 1

0

ここには配列の概念はありません

ステートメント driver.findElement(By.id("declineButton")).click() を使用してください。これでうまくいくと確信しています。

于 2014-04-04T10:15:36.587 に答える