Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on button[type=submit] not working #758

Closed
Ragazzo opened this issue Dec 14, 2013 · 8 comments
Closed

Click on button[type=submit] not working #758

Ragazzo opened this issue Dec 14, 2013 · 8 comments
Assignees
Labels
Milestone

Comments

@Ragazzo
Copy link
Contributor

Ragazzo commented Dec 14, 2013

It is very old bug, so problem is in the title of this issue, code below

$I->click('Some submit'); //button[type=submit]

is not working, and this bug is forcing people to use submitForm that has different locators format as i've described here #726.
So this bug should be definitely fixed.

@tiger-seo
Copy link
Member

Please do provide test to reproduce this.

@Ragazzo
Copy link
Contributor Author

Ragazzo commented Dec 14, 2013

well this is Yii2/Yii1 module bug caused by this method:
https://github.com/Codeception/Codeception/blob/1.8/src/Codeception/Util/Framework.php#L65
As you can see it does not consider button[type=submit].
IndexCept.php

$I = new TestGuy($scenario);
$I->wantTo('perform actions and see result');
$I->amOnPage('/index.html');
$I->see('Login','button'); 
#this will not work even for <input type="submit" name="yt0" value="Login"/>
#same for click, also other locator types not working button[type=submit], etc.

page source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="language" content="en" />
<title>My Web Application - Login</title>
</head>
<body>
<div class="container" id="page">
<div class="form">
<form id="login-form" action="/demo_app/index.php/login" method="post">
    <p class="note">Fields with <span class="required">*</span> are required.</p>
    <div class="row">
        <label for="LoginForm_username" class="required">Username <span class="required">*</span></label>   <input name="LoginForm[username]" id="LoginForm_username" type="text" />        <div class="errorMessage" id="LoginForm_username_em_" style="display:none"></div>   </div>

    <div class="row">
        <label for="LoginForm_password" class="required">Password <span class="required">*</span></label>       <input name="LoginForm[password]" id="LoginForm_password" type="password" />        <div class="errorMessage" id="LoginForm_password_em_" style="display:none"></div>       <p class="hint">
            Hint: You may login with <kbd>demo</kbd>/<kbd>demo</kbd> or <kbd>admin</kbd>/<kbd>admin</kbd>.
        </p>
    </div>

    <div class="row rememberMe">
        <input id="ytLoginForm_rememberMe" type="hidden" value="0" name="LoginForm[rememberMe]" /><input name="LoginForm[rememberMe]" id="LoginForm_rememberMe" value="1" type="checkbox" />        <label for="LoginForm_rememberMe">Remember me next time</label>     <div class="errorMessage" id="LoginForm_rememberMe_em_" style="display:none"></div> </div>


        <button type="submit" name="yt0" >Login</button>

</form></div><!-- form -->
</div><!-- content -->
</div><!-- page -->
</body>
</html>

@Ragazzo
Copy link
Contributor Author

Ragazzo commented Dec 14, 2013

this bugs are not very critical i think but very annoying and can push developers to not to use codeception.

@vjandrea
Copy link

+1 , i have the same problem with Laravel 4.

SeeIfContactFormWorksCept.php:

$I->click('#send input[type=submit]');

Page source:

<div class="form-group">
<input class="btn btn-lg btn-primary btn-block" id="send" type="submit" value="Send"></div>

Result:

1) Failed to see if the contact form works in SeeIfContactFormWorksCept.php
Sorry, I couldn't see "#send input[type=submit]":

9. I see "#send input[type=submit]"

I have the same issue if i try with any of the following:

$I->click('#send');
$I->click('Send');
$I->click('Send','.btn-primary');

@DavertMik
Copy link
Member

I will work on it tomorrow.

@ghost ghost assigned DavertMik Jan 27, 2014
@DavertMik
Copy link
Member

@vjandrea ok, looks like you just used wrong CSS selector
#send points to your submit button. So #send input[type=submit] is invalid in your case.

@Ragazzo how do you find this bugs? really.
Just added your HTML to Codeception tests. Everything work as expected
Check it out 83152fa

@Ragazzo
Copy link
Contributor Author

Ragazzo commented Jan 29, 2014

It was long time ago, will check if this bug still exists, it mainly was noted when bootstrap page style (as you see other user also use bootstrap) was checked, so can you try it with bootstrap and see what can be?

@vjandrea
Copy link

vjandrea commented Feb 7, 2014

@DavertMik after upgrading to 1.8.2 everything turned to green 👍
Modules: PhpBrowser, WebHelper, Laravel4 now work smoothly together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants