Giter Site home page Giter Site logo

Comments (6)

fibble avatar fibble commented on May 12, 2024 2

Got it

Inside DustTestCase.php in the driver() method this works.

$options = new ChromeOptions();
$options->addArguments(array(
'--window-size=571,428',
'--disable-web-security'
));

    return RemoteWebDriver::create(
        'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(ChromeOptions::CAPABILITY, $options)
    );

from dusk.

KKSzymanowski avatar KKSzymanowski commented on May 12, 2024

I think you can do this yourself by overriding the driver method in your /tests/DuskTestCase.php and passing additional options to the web driver.

from dusk.

fibble avatar fibble commented on May 12, 2024

from dusk.

timleland avatar timleland commented on May 12, 2024

@fibble Do you mind sharing how you are able to type into an iframe input?

from dusk.

fibble avatar fibble commented on May 12, 2024

Hi,

I could not work out if there was an easy way to execute arbitrary jquery/javascript in Dusk so i made a nasty quick edit to vendor/laravel/dusk/src/Concerns/InteractsWithElements.php and added this method:

public function jqexec($script){
$this->driver->executeScript($script);
return $this;
}

Then inside my test file (still called ExampleTest.php :) I do something like this:

$this->browse(function ($browser) {
$browser->visit('http://www.yoursite.com/')
->jqexec("window.jQuery('#signInLink').click();")
->jqexec("$('#sign-in-dropdown-frame').contents().find('#input-email').val('[email protected]')")
->jqexec("$('#sign-in-dropdown-frame').contents().find('#input-pwd').val('pass1')")
->jqexec("$('#sign-in-dropdown-frame').contents().find('#button-sign-in').click()")

from dusk.

mikerogne avatar mikerogne commented on May 12, 2024

Poking around in Browser class, I saw it uses Macroable trait. This article was helpful: https://medium.com/@splatEric/writing-tests-with-laravel-dusk-bb755c0dcb1f#.xzjwcvgh1

from dusk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.