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)
2
  • Share the code you have tried so far Commented Oct 23, 2018 at 4:28
  • @AshokkumarGanesan code updated. Commented Oct 23, 2018 at 4:37

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

3 Comments

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.
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.
@sunilshrestha did you manage to achieve your goal? If so, how? I'm looking into this as well. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.