@@ -66,6 +66,8 @@ Using the LambdaTest platform, perform regression testing in just one click and
6666- Access your Hub for your appium ** remote connection** instance at ` @mobile-hub.lambdatest.com/wd/hub ` .
6767- Copy ` LT_USERNAME ` and ` LT_ACCESS_KEY ` credentials from ` Access Key ` button on the top right of the dashboard.
6868
69+ Below are code examples for taking viewport screenshots using SmartUI with Appium across different programming languages and frameworks:
70+
6971<Tabs className =" docs__val " groupId =" language " >
7072<TabItem value =" MacOS/Linux " label =" MacOS/Linux " default >
7173
@@ -300,7 +302,7 @@ await driver.execute("smartui.takeScreenshot", config);
300302### Cross-Framework Examples
301303
302304<Tabs className =" docs__val " groupId =" language " >
303- <TabItem value =" nodejs " label =" NodeJS " default >
305+ <TabItem value =" nodejs " label =" Node.js " default >
304306
305307``` javascript
306308let config = {
@@ -318,24 +320,29 @@ await driver.execute("smartui.takeScreenshot", config);
318320
319321``` python
320322config = {
321- ' screenshotName' : ' <Your Screenshot Name>' ,
322- ' ignoreBoxes' : ' {"xpath": ["//*[@text=\' Dynamic Ad\' ]", "//*[@id=\' timestamp\' ]"]}'
323+ ' screenshotName' : ' <Your Screenshot Name>' ,
324+ ' ignoreBoxes' : ' {"xpath": ["//*[@text=\' Dynamic Ad\' ]", "//*[@id=\' timestamp\' ]"]}'
323325}
324- driver.execute (" smartui.takeScreenshot" , config)
326+ driver.execute_script (" smartui.takeScreenshot" , config)
325327```
326328
327329</TabItem >
328330
329331<TabItem value =" java " label =" Java " >
330332
331333``` java
332- Map<String , Object > config = new HashMap<> ();
333- config. put(" screenshotName" , " <Your Screenshot Name>" );
334- config. put(" ignoreBoxes" , " {\" xpath\" : [\" //*[@text='Dynamic Ad']\" , \" //*[@id='timestamp']\" ]}" );
334+ Map<String , Object > configIgnore = new HashMap<> ();
335+ configIgnore. put(" screenshotName" , " Screenshot" );
335336
336- ((JavascriptExecutor ) driver). executeScript(" smartui.takeScreenshot" , config);
337- ```
337+ Map<String , Object > ignoreBoxes = new HashMap<> ();
338+ ignoreBoxes. put(" xpath" , new String []{
339+ " //*[@name='Toast']"
340+ });
341+
342+ configIgnore. put(" ignoreBoxes" , ignoreBoxes);
343+ ((JavascriptExecutor ) driver). executeScript(" smartui.takeScreenshot" , configIgnore);
338344
345+ ```
339346</TabItem >
340347
341348<TabItem value =" csharp " label =" C# " >
@@ -413,7 +420,7 @@ driver.execute("smartui.takeScreenshot=<Your Screenshot Name>")
413420```
414421
415422</TabItem >
416- <TabItem value =" csharp " label =" C# " default >
423+ <TabItem value =" csharp " label =" C# " >
417424
418425``` csharp
419426driver .Execute (" smartui.takeScreenshot=<Your Screenshot Name>" );
0 commit comments