Automatically click a button on the chrome: // extensions page using selenium webdriver

I am trying to write an automated test that automates the process of updating the chrome google extension. I don’t know another way to do this automatically, so here is what I am trying to do now:

  • Open the chrome extensions page (as far as I know, this is just an html page if I haven't missed anything).

  • Click the "Update Extensions" button

Here is what I tried to open the chrome extensions page:

IwebElement UpdateButton = driver.findelement(By.Id("update-extensions-now"));
UpdateButton.Click();

For some reason, the button click is not logged. I tried some other locators, such as CSS path and Xpath, but they do not work either. Also, when I debug this test, it passes fine, so I know that this is not a problem with any of my locators. I (as a test) tried to automate clicks on other elements on this page, and this is the same problem. I cannot process any elements on the chrome: // extensions page.

Has anyone come across this or had any ideas as to what is going on?

+4
source share
2 answers

You can use the Chrome extension APIs to automatically update the required extension. Find the "manifest.json" file in Google Chrome by default

C:\Users\*UserName*\AppData\Local\Google\Chrome\User Data\Default\Extensions

URL- :

{
  "name": "My extension",
  ...
  "update_url": "http://myhost.com/mytestextension/updates.xml",
  ...
}

XML- Google :

<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
  <app appid='yourAppID'>
    <updatecheck codebase='http://myhost.com/mytestextension/mte_v2.crx' version='2.0' />
  </app>
</gupdate>

AppID , , "". Chrome, "" (chrome://extensions).

URL- .crx.

, .crx, . "version" manifest.json .crx.

XML , .

- - -update-frequency, . , 45 , Google Chrome :

chrome.exe --extensions-update-frequency=45

, , . , , , , .

:

http://test.com/extension_updates.php?x=id%3DyourAppID%26v%3D1.1

exntesions: https://developer.chrome.com/extensions

+1

HTML- "chrome://extensions", , " " iframe. iframe, . :

( #. , , 100%. , . , , iframe, )

String ChromeExtensionsPage = "chrome://extensions";
driver.Navigate().GoToUrl(ChromeExtensionsPage);
driver.Switchto().Frame("DesiredFrame");
IwebElement UpdateButton = driver.findelement(By.Id("DesiredButtonID"));
UpdateButton.Click();
0

All Articles