Cobras played a significant role in the USMC military invasion of the unnamed Middle Eastern country in Call of Duty 4: Modern Warfare. The first sighting is in "The Bog" where Lt. Vasquez calls support from two Cobras to attack a building full of enemies. The most significant role is in "Shock and Awe" where they fire at infantry and armor. The last sighting in Call of Duty 4: Modern Warfare is also in "Shock and Awe" when the nuke goes off.
In Call of Duty: Modern Warfare 2, the Cobra does not appear in the campaign or the Special Ops mode as an Attack Helicopter, only as props in the airplane graveyard in the level "The Enemy of My Enemy" in campaign mode, as the Cobra is only used by the US Marine Corps; the Army use the AH-64 Apache. It is only used in multiplayer matches.It is however mentioned in the radio chatter throughout the campaign giving airsupport and gunstrikes to Marine units.
The AH-1 Cobra is seen in the artwork of the Battle of Berlin, attacking Russian tanks. A Cobra is also seen being destroyed by a SAM Turret firing on it in the Tango Down trailer. It was also seen in one of Yuri's flashbacks flying very fast through the area.
The AH-1W Super Cobra was originally to be used in a campaign mission for Call of Duty 4: Modern Warfare known only as "Cobra Pilot". The player was to provide air support from the helicopter. The mission was cut from the final version of the game, however. The only proof that it ever existed is a file called "compass_map_pilotcobra.iwi" and a file that came with the mod tools called "cobrapilot.str".
Another file, "cobrapilot_controller_layout.iwi", shows that the player would've been able to use Sidewinder missiles, Hellfire missiles, unguided rockets, a 20mm chain gun and flares.
There are also some console commands that could change the way Hellfire missiles act. However, even though they are technically present in the game, they come to no use as the "Cobra Pilot" mission was cut.
In "The Bog", if the player uses the "noclip" cheat and flies up to the AH-1s, the enemies, still firing at at the player, will also unintentionally 'blow up' the Cobras in a silently large explosion, forcing the player to start over again.