@@ -150,8 +150,6 @@ def __init__(self, driver_class, request):
150150 self ._service = None
151151 self .kwargs = {}
152152 self .options = driver_class
153- self .headless = request .config .option .headless
154- self .bidi = request .config .option .bidi
155153
156154 @property
157155 def supported_drivers (self ):
@@ -209,29 +207,15 @@ def driver_path(self):
209207
210208 @property
211209 def headless (self ):
212- if self ._headless :
210+ if self ._request . config . option . headless :
213211 return True
214212 return False
215213
216- @headless .setter
217- def headless (self , value ):
218- self ._headless = value
219- if self ._headless :
220- if self .driver_class .lower () == "chrome" or self .driver_class .lower () == "edge" :
221- self ._options .add_argument ("--headless=new" )
222- if self .driver_class .lower () == "firefox" :
223- self ._options .add_argument ("-headless" )
224-
225214 @property
226215 def bidi (self ):
227- return self ._bidi
228-
229- @bidi .setter
230- def bidi (self , value ):
231- self ._bidi = value
232- if self ._bidi :
233- self ._options .web_socket_url = True
234- self ._options .unhandled_prompt_behavior = "ignore"
216+ if self ._request .config .option .bidi :
217+ return True
218+ return False
235219
236220 @property
237221 def options (self ):
@@ -265,6 +249,16 @@ def options(self, cls_name):
265249 for arg in self .browser_args .split ():
266250 self ._options .add_argument (arg )
267251
252+ if self .headless :
253+ if self .driver_class .lower () == "chrome" or self .driver_class .lower () == "edge" :
254+ self ._options .add_argument ("--headless=new" )
255+ if self .driver_class .lower () == "firefox" :
256+ self ._options .add_argument ("-headless" )
257+
258+ if self .bidi :
259+ self ._options .web_socket_url = True
260+ self ._options .unhandled_prompt_behavior = "ignore"
261+
268262 @property
269263 def service (self ):
270264 executable = self .driver_path
0 commit comments