text: "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4627],{4137:function(e,n,t){t.d(n,{Zo:function(){return s},kt:function(){return m}});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=r.createContext({}),p=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},s=function(e){var n=p(e.components);return r.createElement(u.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,u=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,v=d["".concat(u,".").concat(m)]||d[m]||c[m]||i;return t?r.createElement(v,o(o({ref:n},s),{},{components:t})):r.createElement(v,o({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=d;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=t[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}d.displayName="MDXCreateElement"},8448:function(e,n,t){var r=t(7294);n.Z=function(e){var n=e.children,t=e.hidden,a=e.className;return r.createElement("div",{role:"tabpanel",hidden:t,className:a},n)}},7225:function(e,n,t){t.d(n,{Z:function(){return d}});var r=t(7462),a=t(7294),i=t(1048),o=t(2713);var l=function(){var e=(0,a.useContext)(o.Z);if(null==e)throw new Error('"useUserPreferencesContext" is used outside of "Layout" component.');return e},u=t(3309),p=t(6010),s="tabItem_vU9c";function c(e){var n,t,r,i=e.lazy,o=e.block,c=e.defaultValue,d=e.values,m=e.groupId,v=e.className,f=a.Children.map(e.children,(function(e){if((0,a.isValidElement)(e)&&void 0!==e.props.value)return e;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})),h=null!=d?d:f.map((function(e){var n=e.props;return{value:n.value,label:n.label}})),g=(0,u.lx)(h,(function(e,n){return e.value===n.value}));if(g.length>0)throw new Error('Docusaurus error: Duplicate values "'+g.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.');var b=null===c?c:null!=(n=null!=c?c:null==(t=f.find((function(e){return e.props.default})))?void 0:t.props.value)?n:null==(r=f[0])?void 0:r.props.value;if(null!==b&&!h.some((function(e){return e.value===b})))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+b+'" but none of its children has the corresponding value. Available values are: '+h.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var k=l(),y=k.tabGroupChoices,w=k.setTabGroupChoices,N=(0,a.useState)(b),O=N[0],E=N[1],j=[],x=(0,u.o5)().blockElementScrollPositionUntilNextRender;if(null!=m){var T=y[m];null!=T&&T!==O&&h.some((function(e){return e.value===T}))&&E(T)}var C=function(e){var n=e.currentTarget,t=j.indexOf(n),r=h[t].value;r!==O&&(x(n),E(r),null!=m&&w(m,r))},D=function(e){var n,t=null;switch(e.key){case"ArrowRight":var r=j.indexOf(e.currentTarget)+1;t=j[r]||j[0];break;case"ArrowLeft":var a=j.indexOf(e.currentTarget)-1;t=j[a]||j[j.length-1]}null==(n=t)||n.focus()};return a.createElement("div",{className:"tabs-container"},a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,p.Z)("tabs",{"tabs--block":o},v)},h.map((function(e){var n=e.value,t=e.label;return a.createElement("li",{role:"tab",tabIndex:O===n?0:-1,"aria-selected":O===n,className:(0,p.Z)("tabs__item",s,{"tabs__item--active":O===n}),key:n,ref:function(e){return j.push(e)},onKeyDown:D,onFocus:C,onClick:C},null!=t?t:n)}))),i?(0,a.cloneElement)(f.filter((function(e){return e.props.value===O}))[0],{className:"margin-vert--md"}):a.createElement("div",{className:"margin-vert--md"},f.map((function(e,n){return(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==O})}))))}function d(e){var n=(0,i.Z)();return a.createElement(c,(0,r.Z)({key:String(n)},e))}},2713:function(e,n,t){var r=(0,t(7294).createContext)(void 0);n.Z=r},3786:function(e,n,t){t.r(n),t.d(n,{frontMatter:function(){return l},contentTitle:function(){return u},metadata:function(){return p},toc:function(){return s},default:function(){return d}});var r=t(7462),a=t(3366),i=(t(7294),t(4137)),o=(t(7225),t(8448),["components"]),l={id:"appium-service",title:"Appium Service",custom_edit_url:"https://github.com/webdriverio/webdriverio/edit/main/packages/wdio-appium-service/README.md"},u=void 0,p={unversionedId:"appium-service",id:"appium-service",isDocsHomePage:!1,title:"Appium Service",description:"Handling the Appium server is out of scope of the actual WebdriverIO project. This service helps you to run the Appium server seamlessly when running tests with the WDIO testrunner. It starts the Appium Server in a child process.",source:"@site/docs/_appium-service.md",sourceDirName:".",slug:"/appium-service",permalink:"/docs/appium-service",editUrl:"https://github.com/webdriverio/webdriverio/edit/main/packages/wdio-appium-service/README.md",tags:[],version:"current",frontMatter:{id:"appium-service",title:"Appium Service",custom_edit_url:"https://github.com/webdriverio/webdriverio/edit/main/packages/wdio-appium-service/README.md"},sidebar:"docs",previous:{title:"Delta Reporter Reporter",permalink:"/docs/wdio-delta-reporter-service"},next:{title:"Browserstack Service",permalink:"/docs/browserstack-service"}},s=[{value:"Installation",id:"installation",children:[],level:2},{value:"Configuration",id:"configuration",children:[],level:2},{value:"Options",id:"options",children:[{value:"logPath",id:"logpath",children:[],level:3},{value:"command",id:"command",children:[],level:3},{value:"args",id:"args",children:[],level:3}],level:2}],c={toc:s};function d(e){var n=e.components,t=(0,a.Z)(e,o);return(0,i.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Handling the Appium server is out of scope of the actual WebdriverIO project. This service helps you to run the Appium server seamlessly when running tests with the ",(0,i.kt)("a",{parentName:"p",href:"https://webdriver.io/docs/clioptions"},"WDIO testrunner"),". It starts the ",(0,i.kt)("a",{parentName:"p",href:"http://appium.io/docs/en/about-appium/getting-started/index.html#starting-appium"},"Appium Server")," in a child process."),(0,i.kt)("h2",{id:"installation"},"Installation"),(0,i.kt)("p",null,"The easiest way is to keep ",(0,i.kt)("inlineCode",{parentName:"p"},"@wdio/appium-service")," as a devDependency in your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),", via:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"npm install @wdio/appium-service --save-dev\n")),(0,i.kt)("p",null,"Instructions on how to install ",(0,i.kt)("inlineCode",{parentName:"p"},"WebdriverIO")," can be found ",(0,i.kt)("a",{parentName:"p",href:"https://webdriver.io/docs/gettingstarted"},"here.")),(0,i.kt)("h2",{id:"configuration"},"Configuration"),(0,i.kt)("p",null,"In order to use the service you need to add ",(0,i.kt)("inlineCode",{parentName:"p"},"appium")," to your service array:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// wdio.conf.js\nexport.config = {\n    // ...\n    port: 4723, // default appium port\n    services: ['appium'],\n    // ...\n};\n")),(0,i.kt)("h2",{id:"options"},"Options"),(0,i.kt)("p",null,"The following options can be added to the wdio.conf.js file. To define options for the service you need to add the service to the ",(0,i.kt)("inlineCode",{parentName:"p"},"services")," list in the following way:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// wdio.conf.js\nexport.config = {\n    // ...\n    port: 4723, // default appium port\n    services: [\n        ['appium', {\n            // Appium service options here\n            // ...\n        }]\n    ],\n    // ...\n};\n")),(0,i.kt)("h3",{id:"logpath"},"logPath"),(0,i.kt)("p",null,"Path where all logs from the Appium server should be stored."),(0,i.kt)("p",null,"Type: ",(0,i.kt)("inlineCode",{parentName:"p"},"String")),(0,i.kt)("p",null,"Example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"export.config = {\n    // ...\n    services: [\n        ['appium', {\n            logPath : './'\n        }]\n    ],\n    // ...\n}\n")),(0,i.kt)("h3",{id:"command"},"command"),(0,i.kt)("p",null,"To use your own installation of Appium, e.g. globally installed, specify the command which should be started."),(0,i.kt)("p",null,"Type: ",(0,i.kt)("inlineCode",{parentName:"p"},"String")),(0,i.kt)("p",null,"Example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"export.config = {\n    // ...\n    services: [\n        ['appium', {\n            command : 'appium'\n        }]\n    ],\n    // ...\n}\n")),(0,i.kt)("h3",{id:"args"},"args"),(0,i.kt)("p",null,"Map of arguments for the Appium server, passed directly to ",(0,i.kt)("inlineCode",{parentName:"p"},"appium"),"."),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"http://appium.io/docs/en/writing-running-appium/server-args/index.html"},"the documentation")," for possible arguments.\nThe arguments should be supplied in lower camel case, so ",(0,i.kt)("inlineCode",{parentName:"p"},"--pre-launch true")," becomes ",(0,i.kt)("inlineCode",{parentName:"p"},"preLaunch: true")," or passed as an array."),(0,i.kt)("p",null,"Type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("p",null,"Default: ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")),(0,i.kt)("p",null,"Example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"export.config = {\n    // ...\n    services: [\n        ['appium', {\n            args: {\n                // ...\n                debugLogSpacing: true,\n                platformName: 'iOS',\n                // ...\n            }\n            // or\n            // args: ['-p', '4722', '--relaxed-security', '--log-level', 'info:info']\n        }]\n    ],\n    // ...\n}\n")),(0,i.kt)("hr",null),(0,i.kt)("p",null,"For more information on WebdriverIO see the ",(0,i.kt)("a",{parentName:"p",href:"https://webdriver.io"},"homepage"),"."))}d.isMDXComponent=!0}}]);