2017-01-09 6 views
1

다음은 마지막 탭을 닫지 않는 작은 프로그램입니다. 마지막 탭을 닫지하지만 여러 탭이있는 경우는 하나를 닫습니다 marionette_driver.marionette 수입 마리오네트파이썬 마리오 네트 클라이언트가 마지막 창을 닫지 않습니다.

  client = Marionette("localhost", socket_timeout=30, port=proc_port) 
      client.start_session() 
      client.set_window_size(1024,768) 
      client.close() 

에서

.

client.quit()을 호출하면 오류가 발생합니다.

파이썬 마리오 네트 클라이언트에서 마지막 탭/창을 닫으려면 어떻게해야합니까?

답변

0

나는 이걸 직접 해보겠다. 충돌의 많은 후, 나는 충돌 문자열을 검색하고이 코드를 찾고 mariontte.py

에 대한 모질라 개발 네트워크에 this file에 저를 이끌어 나는이 선을

@do_process_check 
def quit(self, in_app=False): 
    """Terminate the currently running instance. 

    This command will delete the active marionette session. It also allows 
    manipulation of eg. the profile data while the application is not running. 
    To start the application again, start_session() has to be called. 

    :param in_app: If True, marionette will cause a quit from within the 
        browser. Otherwise the browser will be quit immediately 
        by killing the process. 
    """ 
    if not self.instance: 
     raise errors.MarionetteException("quit() can only be called " 
             "on Gecko instances launched by Marionette") 

나는 점점 유지

을 보았다 크래시 quit() can only be called on Gecko instanced launched by Marionette

나는 그 주위를 둘러 보았고 강제 종료 옵션을 보았으므로 시도해 보았고 마지막 Firefox 창을 죽이는 것으로 보인다.

앞으로 Firefox 팀이 문제를 해결할 수도 있고 잘못된 API를 사용 중일 수도 있습니다.

두 개 이상의 탭이 열려있는 경우 해당 창 핸들로 전환하고 해당 창 핸들에서 client.close()를 호출하여 닫을 수 있습니다.

당신은 단지 하나 개의 탭이있는 경우

은 개방하지가 더 이상 일을하고 나를 위해 나는 마지막 창 종료를 닫

client._send_message("quitApplication", {"flags": ["eForceQuit"]}) 

전화를했다.