Skip to content

Instantly share code, notes, and snippets.

View anxp's full-sized avatar

Andrii anxp

View GitHub Profile
@aczietlow
aczietlow / selenium-php-webdriver-cheatsheet.md
Last active March 6, 2024 22:48 — forked from huangzhichong/selenium-webdriver-cheatsheet.md
Cheat sheet for using php webdriver (facebook/webdriver).

Webdriver PHP API workthough

  • Open a browser

    # start an instance of firefox with selenium-webdriver
    
    $browser_type = 'firefox'
    $host = 'http://localhost:4444/wd/hub'
    

$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);

@justinwalsh
justinwalsh / rekey_multi_array.php
Created November 4, 2011 17:28
PHP function to rekey or index a multidimensional array and preserve associative keys
<?php
function rekey_multi_array($array) {
$new = array();
$count = 0;
if (is_array($array)) {
foreach ($array as $key => $val) {
if (!is_numeric($key)) {
$new[$key] = $this -> rekey_multi_array($val);
} else {
$new[$count] = $this -> rekey_multi_array($val);