# Browser Interactions > Source: https://scrape.do/documentation/headless-browser/browser-interactions/ Automate browser interactions in Scrape.do with clicks, scrolls, form fills, and JavaScript execution using playWithBrowser parameter. Scrape.do supports basic JavaScript instructions to interact with the web page you want to scrape. You can create a list of instructions and send it to the system. The system will execute the instructions in the order you send them and return the result to you. > [!NOTE] > You should URL-encode the `playWithBrowser` query parameter value. You can see more details about URL encoding [**here**](/documentation/#encode-your-target-url). Example of a script with multiple instructions: ```json [ { "Action": "Click", "Selector": "#button_id" }, { "Action": "Wait", "Timeout": 5000 } ] ``` **cURL (API mode)** ```bash curl --location --request GET 'http://api.scrape.do/?render=true&playWithBrowser=%5B%7B%22Action%22%3A%22Click%22%2C%22Selector%22%3A%22%23html-page%22%7D%5D&token=YOUR_TOKEN&url=https://httpbin.co/' \ ``` **Python (API mode)** ```python import requests import urllib.parse jsonData = '[{"Action": "Click","Selector":"#html-page"}]' encodedJsonData = urllib.parse.quote_plus(jsonData) token = "YOUR_TOKEN" targetUrl = urllib.parse.quote_plus("https://httpbin.co/") render = "true" url = f"http://api.scrape.do/?token={token}&url={targetUrl}&render={render}&playWithBrowser={encodedJsonData}" response = requests.request("GET", url) print(response.text) ``` **Node.js (API mode)** ```javascript const axios = require('axios'); const token = "YOUR_TOKEN"; const targetUrl = encodeURIComponent("https://httpbin.co/"); const jsonData = '[{"Action":"Click","Selector":"#html-page"}]'; const encodedJsonData = encodeURIComponent(jsonData); const render = "true"; const config = { 'method': 'GET', 'url': `https://api.scrape.do/?token=${token}&url=${targetUrl}&render=${render}&playWithBrowser=${encodedJsonData}` }; axios(config) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); ``` **cURL (Proxy mode)** ```bash curl -k -x "http://YOUR_TOKEN:render=true&playWithBrowser=%5B%7B%22Action%22%3A%22Click%22%2C%22Selector%22%3A%22%23html-page%22%7D%5D@proxy.scrape.do:8080" 'https://httpbin.co/anything' -v ``` **Python (Proxy mode)** ```python import requests import urllib.parse jsonData = '[{"Action": "Click","Selector":"#html-page"}]' encodedJsonData = urllib.parse.quote_plus(jsonData) url = "http://httpbin.co/" token = "YOUR_TOKEN" proxyModeUrl = f"http://{token}:playWithBrowser={encodedJsonData}&render=true@proxy.scrape.do:8080" proxies = { "http": proxyModeUrl, "https": proxyModeUrl, } try: response = requests.request("GET", url, proxies=proxies) print(response.text) except requests.exceptions.ProxyError as e: print(f"Proxy Error: {e}") except requests.exceptions.RequestException as e: print(f"Request Error: {e}") ``` **Node.js (Proxy mode)** ```javascript const axios = require('axios'); const token = "YOUR_TOKEN"; const targetUrl = "http://httpbin.co/"; const jsonData = '[{"Action":"Click","Selector":"#html-page"}]'; const encodedJsonData = encodeURIComponent(jsonData); axios({ method:"GET", url:targetUrl, proxy: { protocol:'http', host: 'proxy.scrape.do', port: 8080, auth: { username: token, password: 'render=true&playWithBrowser=' + encodedJsonData } } }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error.message); }); ``` *(Go, Ruby, Java, C#, PHP examples are also available on the HTML version.)* You can add multiple instructions to the script. Below are examples of all the different instructions you can use. > [!NOTE] > When you also pass `returnJSON=true`, the response includes an `actionResults` array reporting `success`, and any `error`, for each action in your script, in order. A failed selector lookup is reported there while the request itself still returns `200`. ## Actions ### Click To click a button, you will need to use this feature. Use it with the CSS selector of the button you want to click. The scraper will click on the #buttonId button and then return the HTML of the target page. ```json [{ "Action": "Click", "Selector": "#button_id"}] ``` ### Wait Use the wait command with the time in ms you want to **"wait"** for when you need to wait for a fixed amount of time. ```json [{ "Action": "Wait", "Timeout": 1000 }] ``` ### Wait Selector If there is no expected content as a result of a successful return, you can wait for the element by specifying the desired time in ms with the **"wait-selector"** property. ```json [{ "Action": "WaitSelector", "WaitSelector": "#btn", "Timeout": 1000 }] ``` ### Scroll Horizontally Use the **"scroll-x"** attribute with the number of pixels you want to scroll to scroll the target website page horizontally. ```json [{ "Action": "ScrollX", "Value": 100 }] ``` ### Scroll Vertically To scroll the target website page vertically, use the **"scroll-y"** attribute with the number of pixels you want to scroll. ```json [{ "Action": "ScrollY", "Value": 100 }] ``` ### Scroll To With the **"scroll-to"** property, you can scroll for x - y on a per-pixel basis. ```json [{ "Action": "ScrollTo", "Selector": "#btn" }] ``` ### Fill Use the **"fill"** attribute to fill an entry on the target website page. Use it with the CSS selector of the input you want to fill and the value you want to fill it with. ```json [{ "Action": "Fill", "Selector": "#input", "Value": "test" }] ``` ### Execute JavaScript code is executed. If you need to run custom JavaScript, you should use the **"execute"** property. ```json [{ "Action": "Execute", "Execute": "window.document.cookie" }] ``` ### Screenshot The `returnJSON=true` parameter needs to be used. ```json [{ "Action": "ScreenShot" }] [{ "Action": "ScreenShot", "fullScreenShot": "true" }] [{ "Action": "ScreenShot", "particularScreenShot": "#elementSelector" }] ``` ### WaitForRequestCompletion **"WaitForRequestCompletion"** waits for any network request matching the given urlPattern to complete or until the specified timeout is reached. Useful for waiting on dynamically loaded content such as APIs, images, scripts, or other resources. ```json [{ "Action": "WaitForRequestCompletion", "UrlPattern": "*example.com/image*", "Timeout": 10000 }] ``` ### RealClick Selects a random coordinate inside the clickable element and clicks it with operating system specific human behavior, instead of dispatching a synthetic click at the element center. Use it when a plain **"Click"** gets detected or ignored by the target site. ```json [{ "Action": "RealClick", "Selector": "#buy-button" }] ``` > [!NOTE] > If the click triggers a page navigation, use **ClickAndWait** instead so the navigation is tracked and completed before the result is returned. ### RealAction Simulates human behavior on the page for the given time period, specific to the operating system. On desktop it performs mouse movements and scroll wheel scrolling. On mobile it interacts with the page through touch events. Useful for warming up sessions on sites that score user behavior. ```json [{ "Action": "RealAction", "Timeout": 10000 }] ``` ### Focus Triggers the focus event on an element, the same as a user tabbing or clicking into it. Useful before typing into inputs that only initialize on focus. ```json [{ "Action": "Focus", "Selector": "#search-input" }] ``` ### Hover Triggers the hover event on an element. Useful for opening hover-only menus or lazy-loading content that appears on mouseover. ```json [{ "Action": "Hover", "Selector": ".dropdown-menu" }] ``` ### Select Changes the value of a `