diff --git a/lib/binaries/chrome_xml.ts b/lib/binaries/chrome_xml.ts index 5e06e766..606425ce 100644 --- a/lib/binaries/chrome_xml.ts +++ b/lib/binaries/chrome_xml.ts @@ -104,7 +104,11 @@ export class ChromeXml extends XmlConfigSource { // If the semantic version is the same, check os arch. // For 64-bit systems, prefer the 64-bit version. else if (this.osarch === 'x64') { - if (item.includes(this.getOsTypeName() + '64')) { + // No win64 version exists, so even on x64 we need to look for win32 + const osTypeNameAndArch = + this.getOsTypeName() + (this.getOsTypeName() === 'win' ? '32' : '64'); + + if (item.includes(osTypeNameAndArch)) { itemFound = item; } } diff --git a/spec/binaries/chrome_xml_spec.ts b/spec/binaries/chrome_xml_spec.ts index 2c2ca377..ebaa2855 100644 --- a/spec/binaries/chrome_xml_spec.ts +++ b/spec/binaries/chrome_xml_spec.ts @@ -67,6 +67,19 @@ describe('chrome xml reader', () => { }); }); + // This test case covers a bug when all the following conditions were true. + // arch was 64 with multiple major versions available. + it('should not get the 85.0.4183.38, 32-bit version (arch = x64)', (done) => { + let chromeXml = new ChromeXml(); + chromeXml.out_dir = out_dir; + chromeXml.ostype = 'Windows_NT'; + chromeXml.osarch = 'x64'; + chromeXml.getUrl('85.0.4183.87').then((binaryUrl) => { + expect(binaryUrl.url).toContain('85.0.4183.87/chromedriver_win32.zip'); + done(); + }); + }); + it('should get the 87.0.4280.88, 64-bit, m1 version (arch = arm64)', (done) => { let chromeXml = new ChromeXml(); chromeXml.out_dir = out_dir;