Write code that displays a document named modelHDescription.htm in a new browser window that is 400px wide and 300px high, and then brings that window to the front of any other browser windows.

Respuesta :

Answer:

from selenium.webdriver import Chrome

driver = Chrome()

driver.set_window_position(0, 0)

driver.set_window_size(400, 300)

driver.get(r'C:\Users\mateo\Downloads\hola.html')

Explanation:

You haven't provided the programing language in which you need the code, therefore, we will explain it using Python but you can extend it to any programming language using the equivalent selenium.webdriver.  

The selenium.webdriver provides a way of testing web application and can be used to control a web browser, this code is intended for Chrome but can be extended to other browsers by changing the driver call, to open the modelHDescription.htm file use a raw string and the method get, the raw string should contain the path to your .htm file, the method set_window_size let us specify the size of the browser window. It is important to notice that for this code to work you need to install the selenium module in python and download the Chrome-driver depending on the version of your chrome browser.

Ver imagen mateolara11