Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.
This repository was archived by the owner on May 30, 2023. It is now read-only.

PhantomJSDriver could not getting Ajax data ... #13788

@ihlayy

Description

@ihlayy

I setup a local rails server ,using the code below on index.html

<html>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
function test(){
    $.ajax({
                        url:'http://localhost:3000/index',
                        async:false, // if set to true then ok???
                        success:function(data){
                            $('#ajax_ok')[0].innerHTML="data ok";
                        },error: function (xhr, ajaxOptions, thrownError) {

                            $('#ajax_ok')[0].innerHTML=xhr.status;
                        }
                    });

}
</script>
<body>
<a id='mybutton' href="javascript:void(0)" onclick="test()") >click me</a>
<p id="ajax_ok">&nbsp;</p>
</body>
</html>

I use "PhantomJSDriver" to get url , then find the "mybutton' webElement and trigger "click" method.

If i set async to false, in $.ajax() method , i will get the error result (xhr.status = 0),and if i set async to true , everything is ok?

why ? How can i solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions