1

I am trying to automate a plugin in chrome browser. It requires opening an inspect window and perform operation on inspect window. I am able to open inspect window using robot class and navigate among inspect GUI elements but cannot do HTML DOM operation in inspect window. Inspect window contains iframes but I am not able to switch to those iframes from main page. When I try to list the iframes on a active page it only shows iframes from the main page not from the inspect window. I want to switch to inspect window using iframes or any other way if there is any. The code I have written so far is

from pyrobot import Robot
from selenium import webdriver    
from selenium.webdriver.common.keys import Keys
import time

browser = webdriver.Chrome()
browser.get('https://chrome.google.com/webstore/detail/dynamic-assessment-plugin/fnapgcgphlfhecijolobjodbbnjjpdga')
browser.maximize_window()
browser.implicitly_wait(15)
browser.find_element_by_css_selector("[aria-label='Add to Chrome']").click()

time.sleep(3)
robot = Robot()
robot.addExtension() # customized Robot class to add extension

robot.newtab() # customized Robto class for new tab

browser.switch_to.window(browser.window_handles[1])

browser.get('http://www.walmart.com')    

time.sleep(8)   
robot.inspectElement() # Customized Robot class for inspecting (Ctrl+shift+i)
sunil shrestha
  • 27
  • 3
  • 11

1 Answers1

1

While you create chromedriver object in C# this will work,
you need to provide profile by adding arguments in chromeoptions,

ChromeOptions options = new ChromeOptions();
options.AddArguments("--auto-open-devtools-for-tabs");
browser = new ChromeDriver(DrivePath, options, TimeSpan.FromSeconds(100));

You can also try to press F12 it will open inspect window then you can use Robot class or Windows. Forms library for automation scripts manae multiple window Forms.

Your code is in python same answers are alredy provided for java and C#.
You can also refer more at:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29
  • I think the question is unclear to you. I am able to open the inspect window, but I am not able to select elements on the inspect window. – sunil shrestha Oct 23 '18 at 15:28
  • How you can say 'you don't need to select element through inspect element'? The plugin gets attached to inspect window which contains HTML DOM. I need to switch to frame in inspect window. Its not about closing the question, its a genuine question and there is no discussion about this in SO so far. – sunil shrestha Oct 24 '18 at 17:31
  • @sunilshrestha did you manage to achieve your goal? If so, how? I'm looking into this as well. Thanks! – Sébastien De Spiegeleer Sep 25 '21 at 23:18