dalekjs / dalek

[unmaintained] DalekJS Base framework
MIT License
695 stars 63 forks source link

.type() not working #144

Open bijanx opened 9 years ago

bijanx commented 9 years ago

Hello,

I can't get .type() to enter anything into our email input form on our site. It does work fine on amazon for me, everything else remaining the same.

here's the html:

<input autofocus="autofocus" class="login-textfield" id="user_email" name="user[email]" size="30" type="email" value="">

I call .type('#user_email', "email@email.com") then take a screenshot. It's blank.

I tried using setValue but that was resulting in an error. I tried to use the workaround for the Github issue around this setValue bug (backspace chars) but this didn't fix it.

I tried:

ghguy commented 9 years ago

Not sure if it will help, but have have you tried to add new line? e.g.

.type('#user_email', "email@email.com\n")

askilada commented 9 years ago

I have a problem as well. I'm trying to use type within a iframe so I'm trying to do:

.toFrame("#iframe-frame")
.type(".datagrid-search input", 'Hello')

but nothing happend

ghguy commented 9 years ago

Have you tried just:

.type("#iframe-frame", 'Hello') ?

PS. Assuming #iframe-frame is unique across the page.

askilada commented 9 years ago

Yes and my #iframe-frame is also an actual iFrame, and is being updated as i go. I have the same problems with using click inside an iFrame

the way i need to inject those things is via jQuery like

            .execute(function() {
                $('.dialog-footer .btn-close').click()
            })
asciidisco commented 9 years ago

@bpourriahi @askilada Could you please report a few bits on your environment (Which browser you´re testing on, OS, Browser & OS version), that I can try to reproduce the issue.

Also, could you start Dalek with the parameter -l 5 like so dalek mytest.js -l 5, and add a .log.dom('#your_inout_selector', ) method before trying to type something, see http://dalekjs.com/docs/actions.html#meth-log.dom?!

When you have the output, please paste it into the issue (formatted as code) & we can start to debug.

Btw.: @ghguy thanks for helping out with your suggestions :)

rafinskipg commented 9 years ago

Using phantomJS and trying to type in a input text after redirecting from other website, it does not add anything to the input.

rafinskipg commented 9 years ago
.waitForElement('#id_username')
    .log.dom('#id_username')
    .setValue('#id_username', 'MY USER')
    .assert.val('#id_username', 'MY USER', 'Username has been set')

Output

✔ URL We are at Login
▶ WAITFORELEMENT 
☁ [USER] DOM: #id_username  Not found
▶ SETVALUE #id_username
✘ VAL
0 EXPECTED: MY USER
0 FOUND: 
0 MESSAGE: Username has been set
rafinskipg commented 9 years ago

I tried with setValue and type.

rafinskipg commented 9 years ago

When i do

.log.dom('body')

It works, but other selectors are not working, even when i'm seeing that html on the body log

.log.dom('#id_username') //Not found
whiteflame72 commented 8 years ago

I believe for iframe or frame (within frameset), the "frame" is not selectable via CSS selector. Could you try:

document.getElementById("iframe-frame").contentDocument.querySelector('#id_username')

and see if it can be found?