In the Symfony Panther docs it states:
Even if Chrome is the default choice, Panther can control any browser
supporting the WebDriver protocol. It also supports remote browser
testing services such as Selenium Grid (open source), SauceLabs and
Browserstack.
But, there are no other documentation on how to do this.
How do you implement BrowserStack as a remote browser for Panther?
This is how to create a new Panther client using a BrowserStack remote browser:
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Symfony\Component\Panther\Client;
$capabilities = array(
"os" => "OS X",
"os_version" => "Monterey",
"browser" => "Chrome",
"browser_version" => "latest",
"name" => "Test",
"build" => "Build 1.0",
"browserstack.debug" => true,
"browserstack.console" => "info",
"browserstack.networkLogs" => true,
"disableCorsRestrictions" => true,
"wsLocalSupport" => true,
"geoLocation" => "US"
);
$caps = DesiredCapabilities::chrome();
foreach ($capabilities as $key => $value) {
$caps->setCapability($key, $value);
}
$client = Client::createSeleniumClient('https://[YOUR_BROWSERSTACK_USERNAME]:[YOUR_BROWSERSTACK_ACCESS_KEY]#hub-cloud.browserstack.com/wd/hub', $caps);
$client->request('GET', 'https://stackoverflow.com/');
You can see a list of capabilities here: https://www.browserstack.com/automate/capabilities
You can also refer to this -
https://github.com/symfony/panther/blob/main/examples/basic.php
https://stefanoalletti.wordpress.com/2018/07/02/symfony-docker-behat-browserstack-testing-your-app-like-a-boss/
https://symfony.com/blog/introducing-symfony-panther-a-browser-testing-and-web-scrapping-library-for-php
If you face any issue, please create a support ticket with them.
Related
Is it possible to connect to an API with windows Credentials?
I need to connect on an API witch uses Windows AD authentication.
I thought thats works with auth_basic but it's not the good way...
Thanks by advance for your answers
$httpClient = HttpClient::create([
'auth_basic' => ['username', 'password']
]);
$response = $httpClient->request('GET', 'https://apiURL', [
'headers' => ['accept' => 'text/plain'],
]);
dump($response->getStatusCode());
dump($response);
Yes, it's possibile using the auth_ntlm option. But this option is supported only by the cURL client, so you must have the cURL PHP extension installed and enabled in your system.
Here's the code:
$httpClient = new CurlHttpClient(['auth_ntlm' => "username:password"]);
$response = $httpClient->request('GET', 'https://apiURL', [
'headers' => ['accept' => 'text/plain'],
]);
dump($response->getStatusCode());
dump($response);
the API works when ck_ and cs_ keys are for Admin and returns the std class object but when keys are for a different user returns You do not have permission to read this product 401(woocommerce_api_user_cannot_read_product) Error response: even when user has read/write privileges. but goes ahead to create the product in the database. Any help on this issue is highly appreciated
require_once( 'lib/woocommerce-api.php' );
$options = array(
'debug' => true,
'return_as_array' => false,
'validate_url' => false,
'timeout' => 30,
'ssl_verify' => false,
);
try {
$client = new WC_API_Client( $the_url, 'ck_xxxx', 'cs_xxxx', $options);
Try adding into your $options array:
$options['query_string_auth'] = true;
As noted in the documentation this will "Force Basic Authentication as query string true" in other words it will append your consumer key and consumer secret to your request URL as a query string. This is only supported on HTTPS.
According the docs for the Messenger Platform 1.4, the Upload API returns an attachment_id for the uploaded attachment:
{
"attachment_id":"1854626884821032"
}
How do we use this attachment_id to send attachments? Or does simply sending another message with an attachment from the same URL result in messenger using the uploaded attachment?
You should use
$imageAttachment = array('type' => 'image'``, 'payload' => array('attachment_id' => '1854626884821032'));
$params = array('message' => array('attachment' => $imageAttachment), "recipient" => array("id" => $senderId));
and the make a Curl as specified here
https://developers.facebook.com/docs/messenger-platform/send-api-reference/image-attachment
When running the "cucumber" command, the iOS Simluator launches and attempts to open my app. The app's splash screen appears and then the simulator goes back to the home screen. I eventually receive an error stating:
Time out waiting for UIAutomation run-loop to Start.
I can manually start the -cal app in the iOS Simulator through xCode. Any troubleshooting steps I can try to figure out why my app isn't running through the simulator using Calabash?
My environment
$xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$xcodebuild -version
Xcode 6.1.1
Build version 6A2008a
$ calabash-ios version
0.12.2
$ calabash.framework/Resources/version
0.12.2
server_version
{
"app_id" => "com.madeupdomain.MyApp-cal",
"outcome" => "SUCCESS",
"server_port" => 37265,
"version" => "0.12.2",
"app_name" => "Unknown",
"system" => "x86_64",
"simulator_device" => "iPhone",
"simulator" => "",
"app_version" => "1.0",
"iphone_app_emulated_on_ipad" => false,
"git" => {
"revision" => "bafa9fd",
"remote_origin" => "git#github.com:calabash/calabash-ios-server.git",
"branch" => "master"
},
"screen_dimensions" => {
"sample" => 1,
"height" => 1136,
"width" => 640,
"scale" => 2
},
"4inch" => true,
"iOS_version" => "8.2"
}
I got the same problem several times.
First of all check the APP_BUNDLE_PATH
Check the DEVICE_TARGET (if your app does not support that target).
Does your app have a Privacy Alert that appears just after launch?
If so, see the advice on this page:
https://github.com/calabash/calabash-ios/wiki/Managing-Privacy-Alerts:--Location-Services,-APNS,-Contacts
Can you update your question with exact command you are using to start cucumber?
I'm currently stuck with some of Zend's methods, im trying to make a simple Zend_Service_Twitter request through a proxy, however i keep getting:
Unable to Connect to tcp://api.twitter.com:80. Error #0:
php_network_getaddresses: gethostbyname failed.
I am able to do http calls with the Zend_Http_Client library by itself, so I believe my problem is with the code where I pass the httpClient instance to the Zend_Service_Twitter... But enough rant i guess, basically I have the following:
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Proxy',
'proxy_host' => self::PROXY_HOST,
'proxy_port' => self::PROXY_PORT,
'timeout' => 240,
);
$httpClient = new Zend_Http_Client(self::TWITTER_API_URL, $config);
$token = new Zend_Oauth_Token_Access;
$token->setParams(array(
Zend_Oauth_Token_Access::TOKEN_PARAM_KEY => self::TWITTER_OAUTH_TOKEN,
Zend_Oauth_Token_Access::TOKEN_SECRET_PARAM_KEY => self::TWITTER_OAUTH_TOKEN_SECRET
));
$twitter = new Zend_Service_Twitter(array(
'username' => 'MYUSERNAME',
'accessToken' => $token
));
$twitter->getHttpClient($httpClient);
$response = $twitter->account->rateLimitStatus();
Any pointers would be appreciated!
While taking a closer look at the Zend_Service_Twitter class, all you need to do in order to set up the proxy parameters is this:
$twitter = new Zend_Service_Twitter(array(
'username' => 'MYUSERNAME',
'accessToken' => $token
));
$twitter->setLocalHttpClient($twitter->getHttpClient($httpClient));
($httpClient being an instance of Zend_Http_Client which contains your proxy configuration)