id | title | sidebar_label | description | keywords | url | site_name | slug | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
basic-authentication-for-web-automation |
Basic Authentication for Safari Web Automation |
Basic Authentication for Safari Web Automation |
Now you can Basic Authentication during your Safari web automation sessions on iOS real devices with LambdaTest Real Device Cloud Platform with 3000+ real mobile devices. |
|
LambdaTest |
basic-authentication-for-web-automation/ |
import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Biometric Authentication", "item": "https://www.lambdatest.com/support/docs/basic-authentication-for-web-automation/" }] }) }} ></script>Basic Authentication is a method for an HTTP user agent to provide a user name and password when making a request. In basic HTTP authentication, a request contains a header field in the form of Authorization: Basic <credentials>
, where credentials is the Base64 encoding of ID and password joined by a single colon :
.
To provide support for Basic Authentication in Safari during Web Automation, we have introduced a new lambda hook in our iOS
Real Device (RD) web sessions.
:::info
- This hook is not compatible with any app-based sessions.
- The capability
autoAcceptAlerts
must be set tofalse
. :::
Here is an example of how to use the Basic Authentication hook in Python:
data = {
"username": "admin",
"password": "admin",
"url": "https://the-internet.herokuapp.com/basic_auth",
}
driver.execute_script("lambda-ios-set-basic-auth", data)
:::info It is important to note that all three parameters (username, password, URL) are mandatory and must be passed to the script. :::
Please note, this hook is designed to be used exclusively with Safari on iOS Real Device (RD) web sessions and is not compatible with Android sessions or any app-based sessions.