// FIXME: 3. If url is not an absolute URL or is not an absolute URL with fragment or not a local scheme, return error with error code invalid argument.
// FIXME: 4. Handle any user prompts and return its value if it is an error.
// FIXME: 5. Let current URL be the current top-level browsing context’s active document’s URL.
// FIXME: 6. If current URL and url do not have the same absolute URL:
// FIXME: a. If timer has not been started, start a timer. If this algorithm has not completed before timer reaches the session’s session page load timeout in milliseconds, return an error with error code timeout.
// 7. Navigate the current top-level browsing context to url.
m_page_host.page().load(url);
// FIXME: 8. If url is special except for file and current URL and URL do not have the same absolute URL:
// FIXME: a. Try to wait for navigation to complete.
// FIXME: b. Try to run the post-navigation checks.
// FIXME: 9. Set the current browsing context with the current top-level browsing context.
// FIXME: 10. If the current top-level browsing context contains a refresh state pragma directive of time 1 second or less, wait until the refresh timeout has elapsed, a new navigate has begun, and return to the first step of this algorithm.
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Property '{}' is not a Number",name));
autonumber=property->templateto_number<i64>();
if(number<min)
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Property '{}' value {} exceeds the minimum allowed value {}",name,number,min));
if(number>max)
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Property '{}' value {} exceeds the maximum allowed value {}",name,number,max));
returnstatic_cast<i32>(number);
};
// 1. Let width be the result of getting a property named width from the parameters argument, else let it be null.
// 7. If the remote end does not support the Set Window Rect command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 8. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(ensure_open_top_level_browsing_context());
// FIXME: 9. Handle any user prompts and return its value if it is an error.
// FIXME: 10. Fully exit fullscreen.
// 11. Restore the window.
restore_the_window();
Gfx::IntRectwindow_rect;
// 11. If width and height are not null:
if(width.has_value()&&height.has_value()){
// a. Set the width, in CSS pixels, of the operating system window containing the current top-level browsing context, including any browser chrome and externally drawn window decorations to a value that is as close as possible to width.
// b. Set the height, in CSS pixels, of the operating system window containing the current top-level browsing context, including any browser chrome and externally drawn window decorations to a value that is as close as possible to height.
// a. Run the implementation-specific steps to set the position of the operating system level window containing the current top-level browsing context to the position given by the x and y coordinates.
// 1. If the remote end does not support the Maximize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(ensure_open_top_level_browsing_context());
// FIXME: 3. Handle any user prompts and return its value if it is an error.
// FIXME: 4. Fully exit fullscreen.
// 5. Restore the window.
restore_the_window();
// 6. Maximize the window of the current top-level browsing context.
autowindow_rect=maximize_the_window();
// 7. Return success with data set to the WindowRect object for the current top-level browsing context.
// 1. If the remote end does not support the Minimize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(ensure_open_top_level_browsing_context());
// FIXME: 3. Handle any user prompts and return its value if it is an error.
// FIXME: 4. Fully exit fullscreen.
// 5. Iconify the window.
autowindow_rect=iconify_the_window();
// 6. Return success with data set to the WindowRect object for the current top-level browsing context.
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
if(!location_strategy.has_value())
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Location strategy '{}' is invalid",location_strategy_string));
// 3. Let selector be the result of getting a property called "value".
// 4. If selector is undefined, return error with error code invalid argument.
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
if(!location_strategy.has_value())
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Location strategy '{}' is invalid",location_strategy_string));
// 3. Let selector be the result of getting a property called "value".
// 4. If selector is undefined, return error with error code invalid argument.
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
if(!location_strategy.has_value())
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Location strategy '{}' is invalid",location_strategy_string));
// 3. Let selector be the result of getting a property called "value".
// 4. If selector is undefined, return error with error code invalid argument.
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
if(!location_strategy.has_value())
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument,String::formatted("Location strategy '{}' is invalid",location_strategy_string));
// 3. Let selector be the result of getting a property called "value".
// 4. If selector is undefined, return error with error code invalid argument.
// To restore the window, given an operating system level window with an associated top-level browsing context, run implementation-specific steps to restore or unhide the window to the visible screen.
// Do not return from this operation until the visibility state of the top-level browsing context’s active document has reached the visible state, or until the operation times out.
// To maximize the window, given an operating system level window with an associated top-level browsing context, run the implementation-specific steps to transition the operating system level window into the maximized window state.
// To iconify the window, given an operating system level window with an associated top-level browsing context, run implementation-specific steps to iconify, minimize, or hide the window from the visible screen.
// Do not return from this operation until the visibility state of the top-level browsing context’s active document has reached the hidden state, or until the operation times out.
// 5. If a DOMException, SyntaxError, XPathException, or other error occurs during the execution of the element location strategy, return error invalid selector.
if(elements.is_error())
returnWeb::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector,String::formatted("The location strategy could not finish: {}",elements.error().message));
// FIXME: 6. If elements returned is empty and the current time is less than end time return to step 4. Otherwise, continue to the next step.